[Python-Dev] Extended Function syntax (original) (raw)

Wiktor Sadowski Wiktor Sadowski" <art@wiktorsadowski.com
Tue, 28 Jan 2003 02:45:24 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0074_01C2C677.4E939D60 Content-Type: text/plain; charset="windows-1250" Content-Transfer-Encoding: quoted-printable

> What happened to Guido's proposal? >=20 > class Foo(object): > property myprop: > """A computed property on Foo objects.""" >=20 > def get(self): > return ... > def set(self): > ... > def delete(self): > ... =20 I'd be satisfied with that, I think. If Guido likes it too, that's great, and I'll happily give it a +1.

But the problem is that it makes proprty a keyword, which is a Big Change.

class Foo(object): def init(self): self.v =3D [] self.myprop: """A computed property on Foo objects.""" def get(self): return ... def set(self): ... def delete(self): ...

w.s

------=_NextPart_000_0074_01C2C677.4E939D60 Content-Type: text/html; charset="windows-1250" Content-Transfer-Encoding: quoted-printable

> > What happened to Guido's proposal?
> >
> = >_=20_ class Foo(object):
> >      property=20 myprop:
> = >_          """A=20_ computed property on Foo objects."""
> >
>=20 >_          def=20_ __get__(self):
>=20 >_           &nb=_ sp; =20 return ...
> = >_         =20_ def __set__(self):
>=20 >_           &nb=_ sp; =20 ...
> >          = def=20 __delete__(self):
>=20 >_           &nb=_ sp; =20 ...
>
> I'd be satisfied with that, I think. If Guido likes = it=20 too,
> that's great, and I'll happily give it a +1.

>But = the=20 problem is that it makes proprty a keyword, which is a = Big
>Change.
 
class Foo(object):
        def=20 __init__(self):
         =   =20 self.v =3D=20 []
            =

self.myprop:
         &nb= sp;        =20 """A computed property on Foo=20 objects."""
         &nbs= p;         =20 def=20 get(self):
         &= nbsp;           &n= bsp;   =20 return=20 ...
           =          def=20 set(self):
         &= nbsp;           &n= bsp;  =20 ...
           =         =20 def delete(self):<FONT=20 face=3D"Times New = Roman">           =   =20 ...

<FONT face=3D"Times New Roman">w.s

------=_NextPart_000_0074_01C2C677.4E939D60--