[code-quality] pylint: Comprehension Checker
Nathan Marrow
nmarrow at google.com
Thu Nov 2 11:33:16 EDT 2017
Hi,
I'd like to write a new checker for pylint to cover the following cases of
misused comprehensions (and recommended replacements):
- [x for x in y] -> list(y)
- any([x for x in y if z]) -> any(x for x in y if z)
- all([x for x in y if z]) -> all(x for x in y if z)
- [x for x in y if z][0] -> next(x for x in y if z)
- set([x for x in y if z]) -> {x for x in y if z}
I'm wondering if (1) this functionality already exists somewhere (I
couldn't find it), and (2) if not, would you be amenable to a PR that adds
such a checker?
Thanks,
Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/code-quality/attachments/20171102/57991157/attachment.html>
More information about the code-quality
mailing list