[Python-Dev] PEP 318: Properties (original) (raw)

Guido van Rossum guido at python.org
Sun Apr 4 20:22:44 EDT 2004


Then it makes sense to put "x = 42" after the three property definitions (before the end of the class definition). Would that work?

No, for deep reasons that have to do with the implementation of descriptors. This has nothing to do with decorators and not a lot with properties -- it's the same as

class C: def x(self): return self.__x x = 42

today.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list