[Python-Dev] Extended Function syntax

Jim Fulton jim@zope.com
Wed, 22 Jan 2003 13:19:33 -0500


Martin v. L=F6wis wrote:
> Guido van Rossum <guido@python.org> writes:
>=20
>=20
>>I think the final proposal looked like this:
>>
>>  def name(arg, ...) [expr, ...]:
>>      ...body...
>>
>=20
>=20
> I don't think there was much discussion. The suggested semantics was
> that this is equivalent to
>=20
>    def name(arg, ...):
>      ...body...
>    name=3Dexpr(name)
>    ...

In particular:

   def name(arg, ...) [expr1, expr2, expr3]:
       ...body...

would be equivalent to (some variation on):

   def name(arg, ...):
     ...body...

   name=3Dexpr1(expr2(expr3(name)))


I wonder if the same mechanism could be used in class statements.
If I had this, I might say what interface a class implements
with:

   class foo(spam, eggs) [implements(IFoo, IBar)]:
      body of class

or (wo parens):

   class foo [implements(IFoo, IBar)]:
      body of class

Jim

--=20
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org