[Python-Dev] Extended Function syntax

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1250">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>&gt; &gt; What happened to Guido's proposal?<BR>&gt; &gt; <BR>&gt; =
&gt;=20
class Foo(object):<BR>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; property=20
myprop:<BR>&gt; =
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; """A=20
computed property on Foo objects."""<BR>&gt; &gt; <BR>&gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; def=20
__get__(self):<BR>&gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
return ...<BR>&gt; =
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
def __set__(self):<BR>&gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
...<BR>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
def=20
__delete__(self):<BR>&gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
...<BR>&gt; <BR>&gt; I'd be satisfied with that, I think. If Guido likes =
it=20
too,<BR>&gt; that's great, and I'll happily give it a +1.<BR><BR>&gt;But =
the=20
problem is that it makes proprty a keyword, which is a =
Big<BR>&gt;Change.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Times New Roman">class Foo(object):<BR></FONT><FONT=20
face=3D"Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; def=20
__init__(self):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
self.v =3D=20
[]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

self.myprop:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
"""A computed property on Foo=20
objects."""<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
def=20
__get__(self):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
return=20
...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def=20
__set__(self):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;=20
...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
def __delete__(self):</FONT><FONT=20
face=3D"Times New =
Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
...<BR></FONT></DIV>
<DIV><FONT face=3D"Times New Roman">w.s</FONT><BR></DIV></BODY></HTML>

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