[issue17044] Implement PEP 422: Simple class initialisation hook
Daniel Urban
report at bugs.python.org
Sun Feb 17 16:45:19 CET 2013
Daniel Urban added the comment:
Yes, if we would add a regular (instance) method __init_class__ to type, it could (probably) work for regular (non-meta) classes, but not for metaclasses. If a metaclass Meta wouldn't define __init_class__ itself, calling Meta.__init_class__() in __build_class__ wouldn't work, since Meta would inherit the *instance* method from type (its superclass). We might be able to make this work somehow (I'm not sure), but I think adding it to object as a classmethod works fine, and doesn't require special casing.
The attached patch documents, that object has an __init_class__ (and also adds some extra tests). I'll attach a patch to the PEP as well.
----------
Added file: http://bugs.python.org/file29101/pep422_5.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17044>
_______________________________________
More information about the Python-bugs-list
mailing list