[Python-Dev] Extended Function syntax

Guido van Rossum guido@python.org
Wed, 29 Jan 2003 16:42:46 -0500


> > But the problem is that it makes proprty a keyword, which is a Big
> > Change.
> 
> The more kludgy workarounds I see proposed here for *not* having a new
> keyword, the more I feel that it would be worth whatever pain it takes
> to add one, to get a decent, clean, magic-free syntax for properties.

Agreed.  It will take longer, but it's The Right Thing.  Which is why
I'm shooting down all ugly half-solutions.

> It's a bit unfortunate that you've already decided to use "property"
> as a type name. Is that meant to be official, or is it still
> considered an experimental detail?

Does that matter at this point?  It's been in Python 2.2 for over a
year, and we'll can't break that in 2.3.

> If you don't want to change it, maybe the keyword could be something
> else, like defproperty or __property__.

Both are ugly.  (See above. :-)

> Hmmm, lets try that:
> 
>   class Foo(object):
> 
>     __property__ myprop:
> 
>       def __get__(self):
>         ...
> 
>       def __set__(self, x):
>         ...
> 
> Doesn't look too bad, once you get used to the idea that an
> __xxx___ name can be a keyword...

__xxx__ as a keyword is ugly.  (See above. :-)

I'd like the new keyword to be more generally useful than just for
defining property.

--Guido van Rossum (home page: http://www.python.org/~guido/)