On Sun, 13 Nov 2022 at 05:48, Stefan Ram <r...@zedat.fu-berlin.de> wrote: > So much for the topic of "In Python, /everything/ is an > object"! There seem to be first and second-class objects: > Shelveable and non-shelveable objects. >
That's a bit unfair. Everything IS an object, but not all objects can be treated the same way. Complex numbers can't be compared for greater-than/less-than, but they are still first-class objects. Is it acceptable to you if the reconstituted function doesn't have source code (which will affect tracebacks and such), as long as it behaves the same way? If so, save the __code__.co_code attribute, and build a new function from that. ChrisA -- https://mail.python.org/mailman/listinfo/python-list