On Sat, 29 Nov 2014 20:02:50 +0000
Nathaniel Smith <n...@pobox.com> wrote:
> >
> > Option 1b: have __class__ assignment delegate to a tp_classassign slot
> > on the old class, so that typeobject.c doesn't have to be cluttered with
> > many special cases.
> 
> I'm intrigued -- how would this help?

It would allow ModuleType to override tp_classassign to decide whether
and how __class__ assignment on a module instance is allowed to work.
So typeobject.c needn't know about any specifics of ModuleType or any
other type.

> > How do these two options interact with the fact that module functions
> > store their globals dict, not the module itself?
> 
> I think that's totally fine? The whole point of all these proposals is
> to make sure that the final module object does in fact have the
> correct globals dict.
> 
> ~$ git clone g...@github.com:njsmith/metamodule.git

Ok, I see. The code hacks up the new module to take ownership of the
old module's __dict__. That doesn't look very clean to me.

Regards

Antoine.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to