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

2006-10-22 Thread Robert Kern
Tuomas wrote: > #!/usr/bin/python > """test pydev_0.9.3/../pylint""" > __revision__ = "test_mod 0.1 by TV 06/10/22" > > lst = ['aaa', ' bbb', '\tccc\n'] > lst = map(lambda x: x.strip(), lst) > > result = """ > No config file found, using default configuration > * Module test_mod > W:

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

2006-10-22 Thread Georg Brandl
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 effecti

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

2006-10-22 Thread Fredrik Lundh
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).

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

2006-10-22 Thread Tuomas
#!/usr/bin/python """test pydev_0.9.3/../pylint""" __revision__ = "test_mod 0.1 by TV 06/10/22" lst = ['aaa', ' bbb', '\tccc\n'] lst = map(lambda x: x.strip(), lst) result = """ No config file found, using default configuration * Module test_mod W: 6: Used builtin function 'map' E:

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

2006-10-22 Thread Georg Brandl
Tuomas wrote: > #!/usr/bin/python > """test pydev_0.9.3/../pylint""" > __revision__ = "test_mod 0.1 by TV 06/10/22" > > lst = ['aaa', ' bbb', '\tccc\n'] > lst = map(lambda x: x.strip(), lst) > > result = """ > No config file found, using default configuration > * Module test_mod > W:

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

2006-10-22 Thread Tuomas
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 """tes