Replacement for lambda - 'def' as an expression?
Paul Rubin
http
Tue Sep 6 17:01:02 EDT 2005
"Terry Reedy" <tjreedy at udel.edu> writes:
> Are you claiming that including a reference to the more humanly readable
> representation of a function (its source code) somehow detracts from the
> beauty of the function concept?
Huh? Anonymous functions mean you can use functions as values by
spelling out their source code directly, instead of having to make a
separate reference and then pass that. There are times when the
separate reference is just clutter. It's less readable, not more readable.
> Or are you claiming that binding a
> function to a name rather than some other access reference (like a list
> slot) somehow detracts from its conceptual beauty? Is so, would you say
> the same about numbers?
Yes, I would say the same about numbers; Python would suffer if users
were required to give a name to every number. I'd say
x = f(1, 3)
is much less ugly than
one = 1
three = 3
x = f(one, three)
I further don't see how the second example is more "readable" than the first.
More information about the Python-list
mailing list