[Tutor] property built-in

wesley chun wescpy at gmail.com
Thu Oct 19 22:46:46 CEST 2006


> >     x= property(**x())
> >
> > questions:
> >     1: why doesn't there have to be a self in x()?
>
> x is not a "normal" class method.  It is only used as a container to
> hold the "real" methods which are returned in the locals() dictionary.


on a related note, if you're using Python 2.4 and newer, you can
simplfy your code a bit by replacing the call to property() with a
decorator for x, as in:

@property
def x():
    :

cheers,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list