[issue17044] Implement PEP 422: Simple class initialisation hook

Daniel Urban report at bugs.python.org
Wed Mar 13 18:08:17 CET 2013


Daniel Urban added the comment:

I've looked into implementing the changes in the new version of the PEP. It seems, that currently type.__new__ copies the dict returned by __prepare__ (http://hg.python.org/cpython/file/55806d234653/Objects/typeobject.c#l2058). I think this means that some of the new examples wouldn't work ("Order preserving classes" and "Extending a class"). It also means, that currently it is impossible for two classes to share a namespace object (possibly this was the intention of copying the dict). So the "Note" in the PEP wouldn't be necessary (unless type.__new__ were modified).

I'm not sure if the PEP proposes to change this behavior of type.__new__ or not...

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17044>
_______________________________________


More information about the Python-bugs-list mailing list