[Python-Dev] Extended Function syntax

Greg Ewing greg@cosc.canterbury.ac.nz
Thu, 30 Jan 2003 10:07:14 +1300 (NZDT)


Guido:

> 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.

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?

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

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...

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+