Anonymus functions revisited

Kay Schluehr kay.schluehr at gmx.net
Tue Mar 22 01:37:00 EST 2005


Since George Sakkis proposed a new way of doing list comprehensions

http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/ac5023ad18b2835f/d3ff1b81fa70c8a7#d3ff1b81fa70c8a7

letting tuples-like objects (x,y,z=0) acting as functions on other
tuples I wonder why this would not be a good starting point of
rethinking anonymus functions?

In Georges proposition the action is

   (x,y,z=0) -> (x,y,z)

i.e. mapping tuples on other tuples. This is equivalent to

lambda x,y,z=0:(x,y,z)

But regarding tuples as actions by means of an arrow "->" would
generalize this idea:

Mappings like that:

   ((x,y),z)   -> x+y-z

   ((x,y=0),z) -> None

should be valid actions too.

What is the audience thinking about that?

Regards Kay




More information about the Python-list mailing list