[Python-ideas] making a module callable

random832 at fastmail.us random832 at fastmail.us
Wed Nov 20 17:12:42 CET 2013


On Tue, Nov 19, 2013, at 18:20, Chris Angelico wrote:
> But is there any way to avoid the chicken-and-egg problem of trying to
> logically put that into the same source file as the module whose
> metaclass is being changed? Considering that the creation of a class
> involves building up its dictionary of contents and _then_ calling
> type(), it could in theory be possible to build up a dictionary of
> module contents, possibly find something with a magic name like
> __metamodule__, and then use that as the module's type. But this might
> become rather convoluted.

Isn't this how metaclasses used to actually work?


More information about the Python-ideas mailing list