On Nov 1, 2007, at 9:18 PM, Fred Drake wrote: > Thanks! Of all the proposals that have been presented, I still like > that the best. I've attached a quick hack of an implementation, just to play with it and see how it feels. Here's an example use: from property import property class Base(object): @property def attribute(self): print("Base.attribute (getter)") return 42 @property.get(attribute) def rwattribute(self): print("Base.rwattribute (getter)") return self.attribute * 2 @property.set(rwattribute) def rwattribute(self, value): print("Base.rwattribute (setter)") self.saved = value class Derived(Base): @property.get(Base.attribute) def roattribute(self): print("Derived.roattribute (getter)") return self.attribute / 2 -Fred -- Fred Drake <fdrake at acm.org> -------------- next part -------------- A non-text attachment was scrubbed... Name: property.py Type: text/x-python-script Size: 863 bytes Desc: not available Url : http://mail.python.org/pipermail/python-dev/attachments/20071101/70cb9f1c/attachment.bin -------------- next part --------------
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