[Python-Dev] RE: Extended Function syntax
Gerald S. Williams
gsw@agere.com
Tue, 28 Jan 2003 13:20:14 -0500
I wrote:
> Although the following idiom works fine for me: [...]
Or if you want it to look more like the classmethod and
staticmethod idioms, you could do something like this
(probably making propertymethods a bit smarter):
def propertymethods(f):
return property(*f())
class Parrot(object):
def count():
"Treat mostly-parrots as full parrots."
def Get(self): return self._count
def Set(self,count): self._count = int(round(count))
def Del(self): self._count = 0
return Get,Set,Del,"Current parrot count"
count = propertymethods(count)
-Jerry