Bug in eval function?
Graham Breed
usenet at microtonal.co.uk
Wed Apr 14 09:56:20 EDT 2004
Pascal wrote:
>>>>eval('88200')
>
> 88200
>
>>>>eval('00088200')
>
>
> Traceback (most recent call last):
> File "<pyshell#11>", line 1, in -toplevel-
> eval('00088200')
> File "<string>", line 1
> 00088200
> ^
> SyntaxError: invalid token
Yep!
>>> eval('010')
8
A leading zero means an octal number. You can't have digits larger than
7 in octal. The token it says is invalid is invalid. It isn't invalid,
unless you've spotted something more subtle being wrong.
Graham
More information about the Python-list
mailing list