How to write Smart Python programs?

Antoine De Groote antoine at vo.lu
Thu Oct 12 02:30:45 EDT 2006


Antoine De Groote wrote:

> class C(object):
>     def __init__(self): self.__x = None
>     def getx(self): return self._x
>     def setx(self, value): self._x = value
>     def delx(self): del self._x
>     x = property(getx, setx, delx, "I'm the 'x' property.")
> 

Altough I'm not the OP, thanks a lot to everyone, I've learned much in 
this thread. But there's still something that puzzles me, I just realized.

In the snippet above (taken from the Python doc 
http://docs.python.org/lib/built-in-funcs.html), self.__x is 
initialized, but never used. I would appreciate any explanation for this.

Regards,
antoine



More information about the Python-list mailing list