[Python-ideas] A way out of Meta-hell (was: A (meta)class algebra) (original) (raw)
Martin Teichmann lkb.teichmann at gmail.com
Thu Feb 19 13:28:09 CET 2015
- Previous message: [Python-ideas] A way out of Meta-hell (was: A (meta)class algebra)
- Next message: [Python-ideas] A way out of Meta-hell (was: A (meta)class algebra)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Yes, populating class happens inside the interpreter only after the class is fully constructed, so even though the class is fully initialised at the end of init, a reference hasn't been inserted into the cell yet. (The class cell doesn't actually live on the class object - it's created implicitly by the interpreter and then referenced from the individual methods as a closure variable for each method that looks up "class" or "super")
Python 2 doesn't provide the implicitly populated class cell at all though, so you have to refer to the class object by its name - zero argument super is a Python 3 only feature.
In short: PEP 422 in the current form is not back-portable. With my modifications it is portable all the way down to python 2.7.
PEP 422 being back-portable => people will immediately start using it. PEP 422 not back-portable => it won't be used for several years to come.
Greetings
Martin
- Previous message: [Python-ideas] A way out of Meta-hell (was: A (meta)class algebra)
- Next message: [Python-ideas] A way out of Meta-hell (was: A (meta)class algebra)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]