[Python-bugs-list] [ python-Bugs-551673 ] Poor error message for float()

noreply@sourceforge.net noreply@sourceforge.net
Sun, 12 May 2002 10:24:00 -0700


Bugs item #551673, was opened at 2002-05-02 19:49
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=551673&group_id=5470

Category: Python Interpreter Core
Group: Python 2.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Edward C. Jones (edcjones)
Assigned to: Raymond Hettinger (rhettinger)
Summary: Poor error message for float()

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2002-05-12 12:23

Message:
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.

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2002-05-12 02:26

Message:
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.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=551673&group_id=5470