use -> instead of lambda??

Bas bassw at hotmail.com
Fri Mar 12 15:07:55 EST 2004


David MacQuigg <dmq at gain.com> wrote in message news:<s2vu409dio5vc9ndl81dcinteagrkpntf5 at 4ax.com>...
> Seems like we need a simple way to extend Python syntax that doesn't
> break existing syntax or clash with any other syntax in Python, is
> easy to type, easy to read, and is clearly distinct from the "base"
> syntax.  Seems like we could put the @ symbol to good use in these
> situations.  Examples:
> [...]
> @x,y:x*x+y*y    -- anonymous function
> [...]
> It certainly beats adding ugly statements like 'lambda'.

Couldn't we use -> instead??

This wouldn't introduce the the @ symbol (currently forbidden??), but
only uses symbols that are already used. It is thus just another
operator. The -> symbol is already used a lot in the help strings, so
why not use it in the language also?? Maple (symbolic math program)
also uses -> for anonymous functions.



More information about the Python-list mailing list