I have a line like this:
filter(lambda x: x == 1, [1, 1, 2])
Pylint is showing a warning:
W: 3: Used builtin function 'filter'
Why is that? is a list comprehension the recommended method?
Of course I can rewrite this like this:
[x for x in [1, 1, 2] if x == 1]
And I get no warnings, but I was wondering if there's a PEP for this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…