Why should __prepare__ be explicitly decorated as a @classmethod?

Shriramana Sharma samjnaa at gmail.com
Sun May 18 02:26:22 EDT 2014


Hello. I did search for this but couldn't find the info anywhere else, so I'm asking here. Please point out if I've missed some other source of the same info:

https://docs.python.org/3/reference/datamodel.html#basic-customization documents that __new__ is special-cased so that while it is actually a static method, it need not be decorated as such. I have a similar question. IIUC __prepare__ is always a class method to be used in metaclasses, so why isn't it also special-cased so that it need not be decorated as a such?

Thanks.



More information about the Python-list mailing list