This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Poor error message for float()
Type: Stage:
Components: Interpreter Core Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: edcjones, rhettinger
Priority: normal Keywords:

Created on 2002-05-03 00:49 by edcjones, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (3)
msg10646 - (view) Author: Edward C. Jones (edcjones) Date: 2002-05-03 00:49
This line of Python (2.2):

    x = float([0])

gives the error:

    TypeError: float() needs a string argument

But since "float(0)" is OK, a better error message
might be:

    TypeError: the argument of float() must be a string
or a number

I use RedHat 7.1 Linux on a PC.
msg10647 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002-05-12 07:26
Logged In: YES 
user_id=80475

This has been fixed for Python 2.3 which now says:
TypeError: float() argument must be a string or a number.

Will look at backporting to a maintenance release of Python 
2.2.
msg10648 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002-05-12 17:23
Logged In: YES 
user_id=80475

Backported fix from Py2.3 to the Python2.2 maintenance 
release.  Committed as floatobject.c 2.110.6.2.
Closing bug.
History
Date User Action Args
2022-04-10 16:05:17adminsetgithub: 36542
2002-05-03 00:49:08edcjonescreate