Re: [Python-Dev] PEP 573 -- Module State Access from C Extension Methods

2018年4月26日 02:07:00 -0700

- In Python code, __objclass__ should be the defining class, not the module.
Indeed. My idea would be to add an accessor __parent__ returning the m_parent field (whatever it is) and then implement __objclass__ as something like:
@property
def __objclass__(self):
 parent = getattr(self, "__parent__", None)
 if isinstance(parent, type):
 return parent
 else:
 raise AttributeError
In PEP 575, I don't plan to add a Python attribute specifically for getting the defining module: I'll leave that to PEP 573.
_______________________________________________
Python-Dev mailing list
[email protected]
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