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

noreply@sourceforge.net noreply@sourceforge.net
Sun, 12 May 2002 00:26:02 -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: Open
Resolution: None
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 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