tabs and spaces in py3k

Discussion in 'Python' started by rurpy, Dec 8, 2008.

  1. rurpy

    rurpy Guest

    The following code works under 2.6
    ----
    def foo():
    a = 1
    <.tab..>b = 1
    ----
    but results in a TabError in Python 3k

    File "x.py", line 3
    b = 3
    ^
    TabError: inconsistent use of tabs and spaces in indentation

    The py3k docs say the same thing as the 2.6 docs,
    namely that tabs are expanded to spaces prior to
    determining the line's indentation. (Language
    Ref, Lex Anal, Line Struct, Indentation)
    (I wish someone would put the section numbers
    back in the docs.) No mention of this change
    (that I noticed) in What's New or NEWS.txt.

    Do the Py3k docs need correction?
     
    rurpy, Dec 8, 2008
    #1
    1. Advertisements

  2. rurpy

    Lie Ryan Guest

    If I were the maintainer of the parser, I'd add something like this:

    tab_width = random.randint(0, 1000)
     
    Lie Ryan, Dec 8, 2008
    #2
    1. Advertisements

  3. rurpy

    inyeol.lee Guest

    -tt option in python 2.x is now default in python 3.0.
    Apparently it got slipped from any documentation, including what's
    new.

    --Inyeol
     
    inyeol.lee, Dec 8, 2008
    #3
  4. rurpy

    Terry Reedy Guest

    http://bugs.python.org/issue4603
     
    Terry Reedy, Dec 8, 2008
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.