On 10/18/05, Antoine Pitrou <solipsis at pitrou.net> wrote: > Le mardi 18 octobre 2005 à 10:57 -0400, Barry Warsaw a écrit : > Currently I never use properties, because it makes classes much less > readable for the same kind of reasons as what Jim wrote. Me too, I never use properties directly. However I have experimented with using helper functions to generate the properties: _dic = {} def makeproperty(x): def getx(self): return _dic[self, x] def setx(self, value): _dic[self, x] = value return property(getx, setx) class C(object): x = makeproperty('x') c = C() c.x = 1 print c.x But in general I prefer to write a custom descriptor class, since it gives me much more control. Michele Simionato
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