This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Strange behavior with '08' and '09'
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: doerwalter, pyscal, sjoerd
Priority: normal Keywords:

Created on 2004-04-14 15:01 by pyscal, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg20503 - (view) Author: Pascal (pyscal) Date: 2004-04-14 15:01
>>> 06
6
>>> 07
7
>>> 08
SyntaxError: invalid token
>>> 09
SyntaxError: invalid token


>>> 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
msg20504 - (view) Author: Sjoerd Mullender (sjoerd) * (Python committer) Date: 2004-04-14 15:20
Logged In: YES 
user_id=43607

This is not a bug.

Numbers that start with digit 0 are interpreted as octal.  8
and 9 are not legal octal digits, so 08 and 09 are not legal
tokens.

See section 2.4.4 of the Python Language Reference.
msg20505 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-04-14 15:21
Logged In: YES 
user_id=89016

This is not a bug: See 
http://docs.python.org/ref/integers.html for an explanation. 
Numbers starting with '0' are considered octal, and there is no 
digit '8' or '9' in octal.
History
Date User Action Args
2022-04-11 14:56:03adminsetgithub: 40150
2004-04-14 15:01:47pyscalcreate