Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I unindent using IDLE (Python gui)

I want to write the following statment in IDLE (Python GUI)

>>> if x == 0:
...      x = 0
...      print('Negative changed to zero')
... elif x == 0:

How can I get the unindention for the elif statment ?

Some additional facts:

  1. I tried backspace and shift + tab, that doesn't help.
  2. Runing on Windows.

Thanks.


Sorry, you should just use backspace, thing is that ">>>" does not intent on indentation. That means that in:

>>> if x == 54:
         x = 4
elif y = 4:
         y = 6

elif is just as indented as the if statment.

Sorry to waste your time..., although you can blame the IDE for making an un-selfexplanitory UI.

like image 828
Haim Bender Avatar asked Oct 22 '09 22:10

Haim Bender


4 Answers

Ctrl+[ should do the trick for unindenting.

Conversely, you can indent with Ctrl+], but IDLE generally handles indenting much better than unindenting.

like image 181
chaos95 Avatar answered Nov 10 '22 00:11

chaos95


ctrl + [ in Windows

command + [ in Mac

like image 40
beginning Avatar answered Nov 10 '22 00:11

beginning


Backspace works for me.

If you go to Options->Configure IDLE and click on the Keys tab, what options are selected? It might make a difference - I have IDLE Classic Windows.

like image 41
Mark Ransom Avatar answered Nov 10 '22 01:11

Mark Ransom


Try typing it like this. You'll notice the cursor moves to the start of the line after the pass

>>> if x == 0:
        x = 0
        print('Negative changed to zero')
        pass
elif x == 0:
    print('other stuff')
like image 27
John La Rooy Avatar answered Nov 10 '22 01:11

John La Rooy