#99 indention error in python

open
nobody
None
5
2009-03-25
2009-03-25
Anonymous
No

I have following python code:

class dummy():
pass
a='b'
def myFunk(arggg):
return arggg

If cursor is on "def" and I press TAB button on keyboard, then this line aligns itself with "pass" line (jumps 4 spaces forward) - shouldn't do that.
But if cursor is on line, where I assign variable "a", then it does not jump forward (as it supposed to work).
If I remove line 'a="b"', then "def" line still jumps forward, if I press TAB.

I tested it on versions 0.21.0 and 0.22.0 and both versions have this error.

Discussion

  • class dummy():
    ****pass
    a='b'
    def myFunk(arggg):
    ****return arggg

    spaces has gone. Actual code is like this. * are spaces.

     
  • Kevin Krouse
    Kevin Krouse
    2009-03-27

    Yes, it looks like the PythonIndenter doesn't know where a class ends. The indenter should notice the 'a=b' line and use it to indent at that level. Would you like to take a look at the PythonIndenter code and provide a fix?