On 16 September 2013 00:19, Ethan Furman <ethan at stoneleaf.us> wrote: > Three questions: > > > Would the new __initclass__ function be usable with actual full-blown > metaclasses? Sure (as long as the metaclass in question called it at the appropriate time, which those inheriting from type would do automatically)). > The PEP says this: >> If present on the created object, this new hook will be called by the >> class creation machinery after the __class__ reference has been initialised. > > > Given that statement, and this example: > > class A: > def __initclass__(cls): > # do stuff > > class B(A): > pass > > am I correct that A's __initclass__ will not run when B is created? No, that would be pointless (since that's the way class decorators already behave). "present on the created object" means "hasattr(cls, '__initclass__') returns True. > Where are we at with being ready for pronouncement? The PEP needs to be updated to incorporate the feedback from the last time I proposed it for inclusion. That's not going to happen for 3.4, I just forgot to mark it as Deferred - fixed now. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4