Bug!?

Peter Dobcsanyi (peter@mat.aukuni.ac.nz)
04 Aug 1992 11:04:32 +1200 (NZST)

I accidentally found the following strange behavior:

PYTHON SCRIPT:

#!/usr/local/bin/python
#

import string

x = string.atoi('01')
print x

x = string.atoi('07')
print x

x = string.atoi('08')
print x

RESULT:

1
7
SyntaxError: invalid syntax
Stack backtrace (innermost last):
File "p", line 12
x = string.atoi('08')
File "/usr/local/lib/python/string.py", line 110
return eval(str)

INTERACTIVE:

% python
Python 0.9.6 (>= 1 Jan 1992).
Copyright 1990, 1991, 1992 Stichting Mathematisch Centrum, Amsterdam
>>> import string
>>> x = string.atoi('07')
>>>

Python 0.9.6 (>= 1 Jan 1992).
Copyright 1990, 1991, 1992 Stichting Mathematisch Centrum, Amsterdam
>>> import string
>>> x = string.atoi('08')
SyntaxError: invalid syntax
Stack backtrace (innermost last):
File "<stdin>", line 1
File "/usr/local/lib/python/string.py", line 110
return eval(str)
>>>

--
           ,
Peter Dobcsanyi