
Guido:
Actually I was attempting to find a solution not just for properties but for other situations as well. E.g. someone might want to define capabilities, or event handlers, or ...
[Greg]
I'm not sure what a capability is, exactly, so I don't know what would be required to provide one.
Me neither. :-) One person tried to convince me to change the language to allow 'capclass' and 'capability' as keywords (alternatives for 'class' and 'def'). In the end I convinced them that 'rexec' is good enough (if the implementation weren't flawed by security holes, all of which are theoretically fixable). I *still* don't know what a capability is.
Or how an event handler differs from a method, for that matter.
Probably by being hooked up to an event loop automatically.
But anyway, here's another idea:
def foo as property: def __get__(self): ... def __set__(self, x): ...
which would be equivalent to
foo = property(<dict-from-the-suite>)
or perhaps
foo = property(<thunk-doing-the-suite>)
You might also want to allow for some arguments somewhere (not sure exactly where, though).
I don't like things that reuse 'def', unless the existing 'def' is a special case and not just an alternative branch in the grammar. --Guido van Rossum (home page: http://www.python.org/~guido/)