-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
map-builtin-not-iterating reported with reduce() #3051
Comments
Note: it looks like a similar bug was fixed here: #2731 But by the looks of it, I suspect it didn't touch either the Py2 case or the six case of using reduce (it explicitly check fro an 'itertools' root), but I could be mistaken. |
Thanks for the report. Yeah, we'll need a separate solution for |
@DylanYoung
but didn't get your warning in results |
@gyermolenko Did you do a It's possible that it works on Py3 too; I've only tested on Py2. UPDATE: your example works if you add the import (which is to say, it replicates the bug) UPDATE AGAIN: the six actually isn't necessary. I'm able to replicate with the code you've provided. Are you sure you have the py3k errors enabled? You can pass the |
@PCManticore Moreover, I am still getting an error with
|
@PCManticore Also, a question, is there a config option to set other iterating contexts? This could be a good temporary work-around and is probably necessary to fully support this type of error code (dependent on the context of user code, which could be a c-extension that pylint knows nothing about). If there isn't, it might be worth thinking about before the EOL of Py2. |
@DylanYoung Good question, there isn't, but it might be worthwhile to introduce a new option that accepts a list of iterable consuming functions. |
To summarize: Warning in question (
print reduce(lambda x, y: x + y, map(str.upper, "abc")) and for pylint 2.3.1 / python 3.7.4 with python3 example from functools import reduce
print(reduce(lambda x, y: x + y, map(str.upper, "abc")))
==================================================== As for the second issue, with example from itertools import chain
d1, d2 = {}, {}
chain(d1.items(), d2.items()) warning |
Won't do, we removed the python3 porting mode in 2.11. |
Steps to reproduce
map
iterableCurrent behavior
Expected behavior
pylint --version output
pylint 1.9.5,
astroid 1.6.6
Python 2.7.16 (default, Apr 26 2019, 16:26:18)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
The text was updated successfully, but these errors were encountered: