Using map()

Dan Stromberg drsalists at gmail.com
Sun Nov 16 20:31:26 EST 2014


On Sun, Nov 16, 2014 at 4:09 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Pavel Volkov wrote:
>
>> I checked my modules with pylint and saw the following warning:
>>
>> W: 25,29: Used builtin function 'map' (bad-builtin)
>>
>> Why is the use of map() discouraged?
>> It' such a useful thing.
>
> That's a bug in pylint. It's not a bad builtin, it is perfectly fine.
>
> Some people don't like map. Pay no attention to them.

I actually avoid map.

map works as intended; there's nothing particularly wrong with it. In
fact I believe it's pretty important in lisp, but it's a rather
glaring example of TMTOWTDI in Python.

BTW, I believe in Python 2.x map is like a list comprehension, but in
3.x map is like a generator expression.



More information about the Python-list mailing list