[Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement
Daniel Urban
urban.dani+py at gmail.com
Sun Feb 10 21:51:39 CET 2013
More information about the Python-Dev mailing list
Sun Feb 10 21:51:39 CET 2013
- Previous message: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement
- Next message: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Feb 10, 2013 at 5:48 PM, Stefan Behnel <stefan_ml at behnel.de> wrote: > However, it's hard to say if this "new way of doing it" doesn't come with > its own can of worms. For example, would cooperative calls to > "__init_class__" work if a superclass already defines it? Do implementors > have to remember that? And is it clear how this should be done, e.g. what > should normally go first, my own code or the superclass call? Supporting > cooperative __init_class__() calls properly might actually be a good thing. > Currently, there's only one metaclass, plus a sequence of decorators, which > makes the setup rather static and sometimes tedious for subclasses that > need to do certain things by themselves, but in addition to what happens > already. Cooperative multiple inheritance of __init_class__ would work exactly the same way as it works e.g., for __init__ of any other method (actually it is easier, since as Nick mentioned, the signature is always the same): __init_class__ can simply use the zero argument form of super. There is a simple example in the tests at http://bugs.python.org/issue17044. Daniel
- Previous message: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement
- Next message: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list