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

Georg Brandl g.brandl-nospam at gmx.net
Sun Oct 22 14:37:09 EDT 2006


Tuomas wrote:
> Georg Brandl wrote:
>> Some people think that all occurences of map() must be replaced
>> by list comprehensions. The designer of pylint seems to be
>> one of those.
> 
> So it seems, but why?

See Fredrik's post. There's no error in the expression with map(),
it's just less effective than a LC, but only if used with a
lambda.

> Formally spoken we ase "using variable 'x' before 
> assigment" in the comprehension too.

That's another issue. I'd suggest a bug in pylint. (You probably
have a variable called "x" later in the file.

My version of pylint (0.12.1) doesn't show this "error".

Georg



More information about the Python-list mailing list