[Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

Guido van Rossum guido at python.org
Mon Feb 11 18:44:46 CET 2013


Hi Nick,

I think this will make a fine addition to the language. I agree that
it is superior to the alternatives and fulfills a real (if rare) need.

I only have a few nits/questions/suggestions.

- With PJE, I think __init_class__ should automatically be a class
method. The same way that __new__ is automatically a class method.

- Would it make any sense to require that __init_class__ *returns* the
new class object (to complete the similarity with class decorators)?

Frankly, I lost track of things when you were discussing the exact
point in time where __class__ is added to the class. (This may place
me outside the set of people who fully understand Python's
metaclasses. So be it. :-) Perhaps some explanation of the existing
mechanism would be in place? It would be nice if you explained reason
for why __class__ cannot be set earlier in the game (otherwise the
response to this argument would be "so fix it", but somehow I doubt
that is possible). I think it may also be unclear at all times whether
__class__, when referenced, is meant to refer to the metaclass or to
the class under construction.

- I wouldn't add the OrderedMeta/OrderedClass to the PEP. Keep it
focused on enabling.

- Adding more examples would be great.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list