Pylint prefers list comprehension over filter...
Dan Sommers
dan at tombstonezero.net
Thu May 5 23:07:23 EDT 2016
On Fri, 06 May 2016 02:46:22 +0000, Dan Sommers wrote:
> Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
> [GCC 5.3.1 20160409] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> filter(lambda x:x+1, [1, 2, 3, 4])
> [1, 2, 3, 4]
>
> Python 3.5.1+ (default, Apr 17 2016, 16:14:06)
> [GCC 5.3.1 20160409] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> filter(lambda x:x+1, [1, 2, 3, 4])
> <filter object at 0x7f26a9ef3320>
Muphrey's Law strikes again. That lambda function is obviously a
leftover from a call to *map* rather than a call to *filter*, but thanks
everyone for not laughing and pointing.
More information about the Python-list
mailing list