Reputation: 3271
Pycharm highlights ".keys()" on line 5 and gives me following warning for it for this illustrative code:
1 def testfunc():
2 mydic = {}
3 for x in range(5):
4 mydic[x] = str(x)
5 elems = set(mydic.keys())
Python Interpretor: python2.7 from anaconda. Pycharm v2017.3
Can someone help me understand why do I get this warning? Everything works as expected.
Upvotes: 13
Views: 15265
Reputation: 3271
As per user2235698's comment above and based on my verification, this is because of a buggy pycharm version. Please update your pycharm.
Upvotes: 8
Reputation: 2412
I've had this bug in PyCharm 2019.3 too. The problem was that the virtualenv I used was not excluded.
More details: https://youtrack.jetbrains.com/issue/PY-34943
Upvotes: 5