A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2003-January/032480.html below:

[Python-Dev] RE: Extended Function syntax

[Python-Dev] RE: Extended Function syntax [Python-Dev] RE: Extended Function syntaxGerald 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




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