Incorrect warnings in Pycharm 2017.1
Since my recent update to PyCharm 2017.1, python 2.7.6 code which was so far flagged as free of warnings is showing various different warnings which seem to be incorrect. The two most important categories are:
1. Comparison of integers and floats: Gives incorrect warnings that are not even consistent, this seems to be a bug (see code below):
# According to https://docs.python.org/2/library/stdtypes.html#comparisons, we can compare different numeric types:
g0 = (3.0 > 2.0 >= 5.0) # Warning: Expected Type (int), got (float)
g1 = (3.0 > 2.0)
g2 = (2.0 >= 5.0)
g3 = (3.0 > 2.0 > 5.0) # Warning: Expected Type (int), got (float)
g4 = (3 > 5.0) # Warning: Expected Type (int), got (float)
(Note: I am aware of potential problems arising from floating point precisions when comparing floats for equality. However, relative comparison should not be a problem here, so this is not a good reason for issuing a warning.)
2. function arguments and return times when using numpy:
Almost any code written in reasonably elegant numpy style gets drowned in warning messages. A short MWE demonstrating a few of them:
a = np.arange(10.0)
b = round(np.mean(a)) # Unexpected types: (np.ndarray) possible types (SupportsRound)
c = np.linspace(0, 10.0)
d = c[np.array([0, 1])] # Unexpected types: (np.ndarray) possible types (int) (slice)
h = np.argmax(np.arange(10))
i = int(h) # Unexpected Type(s): (np.ndarray)
I believe the reason is to be found in the fact that numpy docstrings rarely include rtype information,
and function may often return very different types depending on input. However, in the last but recent version of Pycharm this
still seemed to work ok (even though certain numpy notations would also give rise to incorrect warnings before).
Currently, using Pycharm 2017.1 in combination with numpy is impossible if one is trying to produce warning-free code.
This is unfortunate, since numpy is the de facto standard for numerical compuation in python, and equally important projects like matplotlib rely on it.
System:
Python 2.7.6
Windows 10
Please sign in to leave a comment.

We are having similar issues in Python 3.5 with the latest version of PyCharm:
PyCharm 2017.1
Build #PY-171.3780.115, built on March 24, 2017
Python 3.5.2
The numpy warnings in particular make any scientific code covered in highlighted warnings.
i also see this for simple range comparisons.
PyCharm 2017.1
Build #PY-171.3780.115, built on March 24, 2017
JRE: 1.8.0_112-release-736-b13 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.10.5
> 1. Comparison of integers and floats: Gives incorrect warnings that are not even consistent, this seems to be a bug
Please follow https://youtrack.jetbrains.com/issue/PY-23367 for updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.
> 2. function arguments and return times when using numpy: Almost any code written in reasonably elegant numpy style gets drowned in warning messages.
Thank you for the report, please file the issues to Pycharm issue tracker: https://youtrack.jetbrains.com/issues/PY and let me know if you have any problems with it. Thank you.