[Python-bugs-list] [ python-Bugs-455775 ] float parsing discrepancy

noreply@sourceforge.net noreply@sourceforge.net
Mon, 27 Aug 2001 12:20:39 -0700


Bugs item #455775, was opened at 2001-08-27 07:25
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=455775&group_id=5470

>Category: Parser/Compiler
>Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Tim Peters (tim_one)
Summary: float parsing discrepancy

Initial Comment:
Typing "3e" or "3e-" or "3e+" to the >>> prompt
or passing them to eval all return 3, which is
reasonable.

Passing any of these strings to float() throws
a value error exception.

What's the deal?

I think float() and the parser should accept the
same set of strings representing floats.  My 
preference (at least for what I'm currently doing)
is to update float() to act like eval rather than
the other way around, but either way is consistent.


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

>Comment By: Tim Peters (tim_one)
Date: 2001-08-27 12:20

Message:
Logged In: YES 
user_id=31435

Exponents must contain a digit, as of

Lib/test/test_compile.py; new revision: 1.7
Parser/tokenizer.c; new revision: 2.52

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-27 09:07

Message:
Logged In: YES 
user_id=6380

Actually, it's a lexer bug that "3e", "3e-" and "3e+" are accepted.

We'll fix the lexer, thank you!

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

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