Bug in eval function?

Shalabh Chaturvedi shalabh at cafepy.com
Wed Apr 14 20:34:47 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
> 

As Graham answered, you're writing octal. And as you see here, it is not 
just eval:

 >>> print 08
   File "<stdin>", line 1
     print 08
            ^

Shalabh





More information about the Python-list mailing list