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

Tuomas tuomas.vesterinen at pp.inet.fi
Sun Oct 22 14:31:22 EDT 2006


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? Formally spoken we ase "using variable 'x' before 
assigment" in the comprehension too.

#!/usr/bin/python
"""test pydev_0.9.3/../pylint"""
__revision__ = "test_mod 0.2 by TV 06/10/22"

lst = ['aaa', ' bbb', '\tccc\n']
# lst = (lambda x: x.strip(), lst) # revision 0.1
lst = [x.strip() for x in lst]

result = """revision 0.1:
No config file found, using default configuration
************* Module test_mod
W:  6: Used builtin function 'map'
E:  6: Using variable 'x' before assigment
...

revision 0.2:
...
Your code has been rated at 10.00/10 (previous run: -10.00/10)
"""



More information about the Python-list mailing list