Adjusting gnome for pythons interactive interpreter?

0

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?

tijko

Posted 2012-11-11T01:39:14.837

Reputation: 260

Answers

1

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.

John Siu

Posted 2012-11-11T01:39:14.837

Reputation: 4 957

if you are using gnome terminal, check the profile setting. – John Siu – 2012-11-11T03:15:54.280