[ python-Bugs-934989 ] Strange behavior with '08' and '09'

SourceForge.net noreply at sourceforge.net
Wed Apr 14 11:21:02 EDT 2004


Bugs item #934989, was opened at 2004-04-14 17:01
Message generated for change (Comment added) made by doerwalter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=934989&group_id=5470

Category: Python Interpreter Core
>Group: Python 2.3
Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Pascal (pyscal)
Assigned to: Nobody/Anonymous (nobody)
Summary: Strange behavior with '08' and '09'

Initial Comment:
>>> 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

----------------------------------------------------------------------

>Comment By: Walter Dörwald (doerwalter)
Date: 2004-04-14 17:21

Message:
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.

----------------------------------------------------------------------

Comment By: Sjoerd Mullender (sjoerd)
Date: 2004-04-14 17:20

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=934989&group_id=5470



More information about the Python-bugs-list mailing list