spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.21k stars 1.59k forks source link

inf in editor is considered a variable, when it is a float #1882

Closed spyder-bot closed 9 years ago

spyder-bot commented 9 years ago

From composi...@gmail.com on 2014-07-06T11:55:57Z

Spyder Version: 2.2.5 Python Version: 2.7.5 Qt Version : 4.8.4, PyQt4 (API v2) 4.9.6 on Windows pyflakes >=0.5.0: 0.7.3 (OK) pep8 >=0.6 : 1.4.6 (OK) IPython >=0.13 : 1.1.0 (OK) rope >=0.9.2 : 0.9.4 (OK) sphinx >=0.6.6 : 1.2 (OK) matplotlib >=1.0: 1.3.1 (OK) sympy >=0.7.0 : None (NOK) pylint >=0.25 : 1.0.0 (OK)

What steps will reproduce the problem?

If you write a line in an editor:

Infinity = inf

the editor will complain and highlight the line and say "undefined variable inf".

What is the expected output? What do you see instead?

inf in python is a float type number, and you can assign variables to it without any problems. The highlight and warning should not be displayed

Please provide any additional information below

.

Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1882

spyder-bot commented 9 years ago

From contrebasse on 2014-07-15T08:01:24Z

In both python2 and python3 I get:

inf Traceback (most recent call last): File "", line 1, in NameError: name 'inf' is not defined

However numpy.inf exists and is of type float. Did you forget "from numpy import *" or something ?

spyder-bot commented 9 years ago

From ccordoba12 on 2014-08-25T00:42:39Z

This problem was solved in version 2.3.0. Previous to that version, we imported the numpy library by default in our Python and IPython consoles and that's why it was defined there, as a float number.

Please update to avoid this and similar problems in the future. By the way, sorry for the confusion.

Status: WontFix