pylint: What's wrong with the builtin map()

Fredrik Lundh fredrik at pythonware.com
Sun Oct 22 14:21:38 EDT 2006


Tuomas wrote:

 > lst = map(lambda x: x.strip(), lst)

list comprehensions are more efficient than map/lambda combinations;
the above is better written as:

    lst = [x.strip() for x in lst]

in general, map() works best when the callable is an existing function 
(especially if it's a built-in).  not sure if pylist is smart enough to 
tell the difference, though.

</F>




More information about the Python-list mailing list