Applications/examples of some advanced Py features, please !
Ben Wolfson
wolfson at midway.uchicago.edu
Sat Jan 4 14:58:03 EST 2003
On Sat, 04 Jan 2003 12:46:37 -0700, Andrew Dalke <adalke at mindspring.com>
wrote:
>1. Don't use lambda.
>
>It's good for a few things, but in many cases you should use a
>list comprehension. For an example, cgi.py has
>
> plist = map(lambda x: x.strip(), line.split(';'))
>
>as a list comprehension this is more more clearly written as
>
> plist = [x.strip() for x in line.split(';')]
I think this is even more clear written as
plist = map(str.strip, line.split(';'))
--
You're going to set me up as a kind of slovenly attached pig that
Jack Kornfeld can slice down in his violent zen compassion?
-- Larry Block
More information about the Python-list
mailing list