Ian Bicking: the old part of his blog

Re: property decorator

source
For getters and setters, I like this:

class Foo(object):
    @apply
    def bar():
        def fget(self):
            return self.whatever
        def fset(self, value):
            self.whatever = value
        return property(**locals())

fdel and doc can be added if needed.
And, if the "**locals()" seems too magical "fget, fset" can be substituted.
Comment on property decorator
by Benji York

Comments:

I can't get myself to like any of those kinds of recipes for getters and setters. In SQLObject I added something to the metaclass to automatically turn _get_* and _set_* functions into getters and setters, and the Wareweb I changed the convention to *__get, since that seems more obviously special (code for that is in paste.util.classinit)

# Ian Bicking

A clean namespace is good, but a namespace can be _too_ clean.

Having '_get_something' '_set_something' available is usually nice.

# anonymous

I'd prefer camel cased versions, and preferably, set the decorator myself. (Like the python 2.3 notation)

# rboerma