Pycharm irregular attribute warning

Pay attention to the following code:

import numpy as np

r = [1, 0, -1, 0]
bins = np.fft.fft(r) / len(r)
x = bins.view(float)

      

Considering the above code, PyCharm returns this warning: Unresolved attribute reference 'view' for class 'int'

If I split line 4 into two lines like

bins = np.fft.fft(r)
bins = bins / len(r)

      

the same warning appears. Only the following warning doesn't trigger:

bins = np.fft.fft(r)
bins /= len(r)

      

Why does PyCharm consider bins

by type int

in the first two versions, and how and why does the added assignment change this behavior?

I am running PyCharm 4.5.1 Community Edition on Yosemite.

+3
python-3.4 pycharm augmented-assignment


source to share


No one has answered this question yet

Check out similar questions:

324
Unresolved reference issue in PyCharm
248
PyCharm showing unresolved references error for valid code
22
Why does PyCharm give unresolved reference errors regarding some Numpy imports?
12
PyCharm getitem warning for functions with arrays
7
PyCharm: "The function returns nothing"
4
Piharma visual warning of an unresolved attribute reference
2
PyCharm warnings and expected types: when to look after?
2
PyCharm TensorFlow Warning - Type "Variable" does not have expected attribute "__sub__"
1
Why isn't Pycharm catching the type error?
0
Using PyCharm's f-string in a class displays a warning (unresolved attribute reference '__name' for class ...)



All Articles
Loading...
X
Show
Funny
Dev
Pics