Anonymus functions revisited
apardon at forel.vub.ac.be
Tue Mar 22 10:53:23 CET 2005
Op 2005-03-22, Claudio Grondi schreef <claudio.grondi at freenet.de>:
> For me, one of the reasons for using Python
> is the ease and the intuivity of reading its
> I have a problem with intuitively getting
> what is going on when using a pattern like
> (x,y,z=0) -> (x,y,z)
> where I expect at the first glance some
> C code with access to class members.
> At least I must start looking at the code
> more closely thinking why is someone
> using such a construct.
> lambda x,y,z=0:(x,y,z)
> is a problem for me.
> Why not:
> except NameError:
Because they are not equivallent.
> Watching the last piece of code
> can even directly be seen, that there
> is eventually a NameError
> problem with z to handle,
And suppose there is a NameError with x,
your piece of code will then assign 0 to
z. Do you think that is what the original
> so where is the gain of using
> lambda or the mapping?
Is is usable as an argument.
More information about the Python-list