Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running lisa mint 3.0.0-12-generic with gnome 3.2.1 as my Desktop Environment. Whenever I open my python 2.7.2 interactive interpreter to try out some code snippets, using the tab-key has strange behavior.

I'll start a loop or any kind of nested expression:

>>> while True:
>>>     if this == that:    /-- > this indents with tab 4-spaces
>>>             for i in that:  /-- > this line will indent using tab 8-spaces??

I've been searching around and have been finding this isn't controlled by python but, by the windowing system on my OS. Is there a specific configuration file to edit in gnome that will change the way the tab-key indents?

share|improve this question

The terminal tab count start from column 1, and it is 8 spaces per tab.

You thought 1st tab is 4 spaces because you start counting from where you start typing. If you count ">>> " plus 4 spaces, the 1st tab is actually 8 spaces.

You will see it is 8 spaces for 2rd tab and so on.

Tab width in terminal screen can be changed to 4 following command

tabs -4

You can change 4 to any number you like.

However, that doesn't work inside python shell. The python shell must has its own tab setting.

share|improve this answer
if you are using gnome terminal, check the profile setting. – John Siu Nov 11 '12 at 3:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .