On Oct 16, 2005, at 9:56 AM, Nick Coghlan wrote: > On and off, I've been looking for an elegant way to handle > properties using > decorators. This isn't my idea, and it might have been brought up here in the past to the same sorts of screams of horror to which you refer later, but I use the 'apply' pattern without too many internal objections for this: class Foo(object): # just a simple example, practically pointless _my_property = None @apply def my_property(): def get(self): return self._my_property def set(self, value): self._my_property = value return property(get, set) IMHO, I find this easier to parse than either of your two examples. Apologies if this has already been screamed at. :-) Gary
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