A Q concerning map (a comparison to Maple V)

Franz GEIGER fgeiger at datec.at
Sat Dec 23 04:48:30 EST 2000


When I encountered Python a few month ago now, it made me remember Maple V.
Maple has map, select, zip etc. like Python. But Maple handles map e.g. more
generously in terms of argument passing. So you can apply
f:=(x,y)->x^2+y
to a list and an ADDITIONAL argument like so:
map(f, L, 5);
If L was [1,2,3] this would yield [6, 9, 14].
If Python could do this too, I e.g could apply replace to a list of strings
like so:
map(replace, ["abc", "cde"], "c", "C");
instead of having to create a lambda function.
Wouldn't it make sense to have that in Python too? Do there come more such
opportunities into your mind?

Best regards
Franz GEIGER






More information about the Python-list mailing list