Pycharm unresolved attribute reference warning

1.6k Views Asked by At

Please consider the following code:

import numpy as np

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

Given 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 does not throw a warning:

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

Why does PyCharm treat bins as of type int in the first two versions and how and why does augmented assignment change this behavior?

I am running PyCharm 4.5.1 Community Edition on Yosemite.

0

There are 0 best solutions below