08 and 09 in sequence create "invalid token" error?!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • IamIan

    #1

    08 and 09 in sequence create "invalid token" error?!

    Hello all,

    I am confused as to why including 08 or 09 in a sequence (list or
    tuple) causes this error. All other numbers with a leading zero work.

    [01,02,03,04,05, 06,07] is fine
    [01,02,03,04,05, 06,07,10] is fine

    [01,02,03,04,05, 06,08] produces "SyntaxErro r: invalid token", as
    does: [01,02,03,04,05, 06,09]

    I have tried this both in a script and in the interactive interpreter.
    Using Python 2.3.4

    Thanks!

  • =?ISO-8859-2?Q?Wojciech_Mu=B3a?=

    #2
    Re: 08 and 09 in sequence create "invali d token" error?!

    IamIan wrote:
    I am confused as to why including 08 or 09 in a sequence (list or
    tuple) causes this error. All other numbers with a leading zero work.
    All literals that start with "0" digit are considered as
    octal numbers, i.e. only digits "0".."7" are allowed.

    See octinteger lexical definition:


    w.

    Comment

    • IamIan

      #3
      Re: 08 and 09 in sequence create "invali d token" error?!

      Thank you!

      Ian

      Comment

      Working...