Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"I DO want your money, because god wants your money!" -- The Reverend Jimmy, from _Repo_Man_


devel / comp.lang.python / Re: Dealing with non-callable classmethod objects

SubjectAuthor
o Re: Dealing with non-callable classmethod objectsCameron Simpson

1
Re: Dealing with non-callable classmethod objects

<mailman.959.1668298372.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=20335&group=comp.lang.python#20335

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: cs...@cskk.id.au (Cameron Simpson)
Newsgroups: comp.lang.python
Subject: Re: Dealing with non-callable classmethod objects
Date: Sun, 13 Nov 2022 11:12:46 +1100
Lines: 23
Message-ID: <mailman.959.1668298372.20444.python-list@python.org>
References: <Y3AnX8zQzlq1K30/@cskk.homeip.net>
<Y3A2foeyIhGlmCAx@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Trace: news.uni-berlin.de zBKfNl3+4JyAtnDoYbQ20AtF6poYL9HJTivaMJrr0wNQ==
Return-Path: <cameron@cskk.id.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'partial': 0.07; 'filled':
0.09; 'cheers,': 0.11; 'import': 0.15; 'cameron': 0.16; 'first:':
0.16; 'from:addr:cs': 0.16; 'from:addr:cskk.id.au': 0.16;
'from:name:cameron simpson': 0.16; 'lambda': 0.16; 'message-
id:@cskk.homeip.net': 0.16; 'received:13.237': 0.16;
'received:13.237.201': 0.16; 'received:13.237.201.189': 0.16;
'received:cskk.id.au': 0.16; 'received:id.au': 0.16;
'received:mail.cskk.id.au': 0.16; 'simpson': 0.16; 'skip:> 10':
0.16; 'wrote:': 0.16; 'to:addr:python-list': 0.20; 'function':
0.27; 'header:User-Agent:1': 0.30; 'header:In-Reply-To:1': 0.34;
'received:au': 0.35; 'received:13': 0.64; 'received:userid': 0.66;
'skip:f 30': 0.71; 'skip:f 20': 0.75; 'produces': 0.76; 'closure':
0.84; 'factory': 0.84
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <Y3AnX8zQzlq1K30/@cskk.homeip.net>
User-Agent: Mutt/2.2.7 (2022-08-07)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <Y3A2foeyIhGlmCAx@cskk.homeip.net>
X-Mailman-Original-References: <Y3AnX8zQzlq1K30/@cskk.homeip.net>
 by: Cameron Simpson - Sun, 13 Nov 2022 00:12 UTC

On 13Nov2022 10:08, Cameron Simpson <cs@cskk.id.au> wrote:
>On 13Nov2022 07:57, Cameron Simpson <cs@cskk.id.au> wrote:
>> # replace fctory with a function calling factory.__func__
>> factory = lambda arg: factory.__func__(classmethod, arg)
>
>It just occurred to me that you might need to grab the value of
>factory.__func__ first:
>
> factory0 = factory
> factory = lambda arg: factory0.__func__(classmethod, arg)
>
>Otherwise the closure might introduce a recursion.

Or avoid the closure:

from functools import partial
......
factory = partial(factory.__func__, classmethod)

to produces a partially filled in function.

Cheers,
Cameron Simpson <cs@cskk.id.au>

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor