[Tutor] strange eval

Doug Penny doug.penny at gmail.com
Mon Oct 4 14:54:49 CEST 2004


I have a couple of students working on some programming projects and
they are experiencing some strange issues with eval.  We are working
on Windows 2000 boxes using Python 2.3.4.  For the most part eval
seems to work fine.  For instance, these commands work well:

>>>eval("07")
7
>>>eval("10")
10

However, 08 and 09 do not work.  We get the following error:

>>>eval("08")
Traceback (most recent call last):
 File "<pyshell#0>", line 1, in -toplevel-
   eval("08")
 File "<string>", line 1
   08
    ^
SyntaxError: invalid token

>>>eval("09")
Traceback (most recent call last):
 File "<pyshell#1>", line 1, in -toplevel-
   eval("09")
 File "<string>", line 1
   09
    ^
SyntaxError: invalid token

It seems like this are the only two number that have trouble.  Has
anyone else experienced this problem?  Thanks.

Doug Penny


More information about the Tutor mailing list