Dealing with non-callable classmethod objects

Cameron Simpson cs at cskk.id.au
Sat Nov 12 18:08:15 EST 2022


On 13Nov2022 07:57, Cameron Simpson <cs at 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.

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


More information about the Python-list mailing list