Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #27838 > unrolled thread

Is there a way to configure IDLE to use spaces instead of tabs for indenting?

Started by"Alex" <foo@email.invalid>
First post2012-08-24 22:33 +0000
Last post2012-10-17 15:34 +0000
Articles 13 — 5 participants

Back to article view | Back to comp.lang.python


Contents

  Is there a way to configure IDLE to use spaces instead of tabs for indenting? "Alex" <foo@email.invalid> - 2012-08-24 22:33 +0000
    Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting? Terry Reedy <tjreedy@udel.edu> - 2012-08-25 07:29 -0400
      Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting? "Alex" <foo@email.invalid> - 2012-08-25 12:50 +0000
        Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-25 14:20 +0100
          Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting? "Alex" <foo@email.invalid> - 2012-08-25 14:17 +0000
            Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting? Terry Reedy <tjreedy@udel.edu> - 2012-08-25 14:36 -0400
    Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting? Ramchandra Apte <maniandram01@gmail.com> - 2012-09-05 06:04 -0700
      Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting? "Alex" <foo@email.invalid> - 2012-09-06 13:43 +0000
        Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting? Ramchandra Apte <maniandram01@gmail.com> - 2012-09-06 06:54 -0700
        Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting? Terry Reedy <tjreedy@udel.edu> - 2012-09-06 14:11 -0400
          Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting? "Alex" <foo@email.invalid> - 2012-09-07 01:40 +0000
        Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting? Fabio Zadrozny <fabiofz@gmail.com> - 2012-10-17 12:10 -0300
          Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting? "Alex" <foo@email.invalid> - 2012-10-17 15:34 +0000

#27838 — Is there a way to configure IDLE to use spaces instead of tabs for indenting?

From"Alex" <foo@email.invalid>
Date2012-08-24 22:33 +0000
SubjectIs there a way to configure IDLE to use spaces instead of tabs for indenting?
Message-ID<k18vgg$sp9$1@dont-email.me>
I'm new to Python and have been using IDLE 3.2.3 to experiment with
code as I learn. Despite being configured to use a 4 space indentation
width, sometimes IDLE's "smart" indentation insists upon using width-8
tabs.

From what I've been able to find on Google, this is due to a
shortcoming in Tk. While it's not that big a deal in the grand scheme
of things, I think it looks like poop, and I'd like to change IDLE to
use 4-space indentation instead of tabs for all indentation levels.

Is there any way for me to achieve what I want in IDLE, or do I have to
start up my full-blown IDE if I want consistent 4-space indentation?

Alex 

[toc] | [next] | [standalone]


#27868

FromTerry Reedy <tjreedy@udel.edu>
Date2012-08-25 07:29 -0400
Message-ID<mailman.3800.1345894235.4697.python-list@python.org>
In reply to#27838
On 8/24/2012 6:33 PM, Alex wrote:
> I'm new to Python and have been using IDLE 3.2.3 to experiment with
> code as I learn. Despite being configured to use a 4 space indentation

That applies to the editor and works in the editor for me and others. A 
tab becomes 4 space characters, and a backspace in the appropriate place 
deletes 4 space characters.

> width, sometimes IDLE's "smart" indentation insists upon using width-8
> tabs.

Only for the simulated interpreter. There is a tracker issue about 
changing that but no consensus.


-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#27871

From"Alex" <foo@email.invalid>
Date2012-08-25 12:50 +0000
Message-ID<k1ahn4$dci$1@dont-email.me>
In reply to#27868
Terry Reedy wrote:

> On 8/24/2012 6:33 PM, Alex wrote:
> > Despite being configured to use a 4 space
> > indentation
...
> > sometimes IDLE's "smart" indentation insists upon using
> > width-8 tabs.
> 
> [The 4-space indentation setting] applies to the editor and works in 
> the editor for me and others.
> 
> [The width-8 tabs are inserted] Only for the simulated interpreter.
> There is a tracker issue about changing that but no consensus.

Yes, it works in the editor. I was referring to the simulated
interpreter. I guess I didn't make that clear.

In my search for a solution, I did see some of the traffic regarding
the tracker issue, but the posts were all several years old and I was
hoping maybe there was a fix by now. I guess not. Maybe in Python 4, eh?

Thanks.

Alex

[toc] | [prev] | [next] | [standalone]


#27873

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2012-08-25 14:20 +0100
Message-ID<mailman.3803.1345900732.4697.python-list@python.org>
In reply to#27871
On 25/08/2012 13:50, Alex wrote:
> Terry Reedy wrote:
>
>> On 8/24/2012 6:33 PM, Alex wrote:
>>> Despite being configured to use a 4 space
>>> indentation
> ...
>>> sometimes IDLE's "smart" indentation insists upon using
>>> width-8 tabs.
>>
>> [The 4-space indentation setting] applies to the editor and works in
>> the editor for me and others.
>>
>> [The width-8 tabs are inserted] Only for the simulated interpreter.
>> There is a tracker issue about changing that but no consensus.
>
> Yes, it works in the editor. I was referring to the simulated
> interpreter. I guess I didn't make that clear.
>
> In my search for a solution, I did see some of the traffic regarding
> the tracker issue, but the posts were all several years old and I was
> hoping maybe there was a fix by now. I guess not. Maybe in Python 4, eh?
>
> Thanks.
>
> Alex
>

For the record issue 7676, yes?

-- 
Cheers.

Mark Lawrence.

[toc] | [prev] | [next] | [standalone]


#27874

From"Alex" <foo@email.invalid>
Date2012-08-25 14:17 +0000
Message-ID<k1amqg$asi$1@dont-email.me>
In reply to#27873
Mark Lawrence wrote:

> On 25/08/2012 13:50, Alex wrote:
> > Terry Reedy wrote:
> > 
> > > On 8/24/2012 6:33 PM, Alex wrote:
> > > > Despite being configured to use a 4 space
> > > > indentation
> > ...
> > > > sometimes IDLE's "smart" indentation insists upon using
> > > > width-8 tabs.
> > > 
> > > [The 4-space indentation setting] applies to the editor and works
> > > in the editor for me and others.
> > > 
> > > [The width-8 tabs are inserted] Only for the simulated
> > > interpreter.  There is a tracker issue about changing that but no
> > > consensus.
> > 
> > Yes, it works in the editor. I was referring to the simulated
> > interpreter. I guess I didn't make that clear.
> > 
> > In my search for a solution, I did see some of the traffic regarding
> > the tracker issue, but the posts were all several years old and I
> > was hoping maybe there was a fix by now. I guess not. Maybe in
> > Python 4, eh?
> > 
> > Thanks.
> > 
> > Alex
> > 
> 
> For the record issue 7676, yes?

Yes, that appears to be the issue I was talking about and is, in fact,
one of the threads I had looked at before posting here. Of course, I
didn't pay enough attention to the dates. I see the most recent posting
on the issue appears to have been made in January of this year, so I
should have realized it's an ongoing issue.

[toc] | [prev] | [next] | [standalone]


#27881

FromTerry Reedy <tjreedy@udel.edu>
Date2012-08-25 14:36 -0400
Message-ID<mailman.3809.1345919856.4697.python-list@python.org>
In reply to#27874
On 8/25/2012 10:17 AM, Alex wrote:

> Yes, that appears to be the issue I was talking about and is, in fact,
> one of the threads I had looked at before posting here. Of course, I
> didn't pay enough attention to the dates. I see the most recent posting
> on the issue appears to have been made in January of this year, so I
> should have realized it's an ongoing issue.

There have also been a few posts this year on the idle-sig mail list.

There are only a few people working on IDLE and we have concentrated 
this calendar year on fixing crashers, not semi-aesthetic issues.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#28488

FromRamchandra Apte <maniandram01@gmail.com>
Date2012-09-05 06:04 -0700
Message-ID<a3ba743e-85df-42de-90bc-33bf5cf96c02@googlegroups.com>
In reply to#27838
On Saturday, 25 August 2012 04:03:52 UTC+5:30, Alex  wrote:
> I'm new to Python and have been using IDLE 3.2.3 to experiment with
> 
> code as I learn. Despite being configured to use a 4 space indentation
> 
> width, sometimes IDLE's "smart" indentation insists upon using width-8
> 
> tabs.
> 
> 
> 
> From what I've been able to find on Google, this is due to a
> 
> shortcoming in Tk. While it's not that big a deal in the grand scheme
> 
> of things, I think it looks like poop, and I'd like to change IDLE to
> 
> use 4-space indentation instead of tabs for all indentation levels.
> 
> 
> 
> Is there any way for me to achieve what I want in IDLE, or do I have to
> 
> start up my full-blown IDE if I want consistent 4-space indentation?
> 
> 
> 
> Alex

I think an IDE is better than IDLE. Try NINJA IDE. http://ninja-ide.org

[toc] | [prev] | [next] | [standalone]


#28595

From"Alex" <foo@email.invalid>
Date2012-09-06 13:43 +0000
Message-ID<k2a99q$vam$1@dont-email.me>
In reply to#28488
Ramchandra Apte wrote:

> On Saturday, 25 August 2012 04:03:52 UTC+5:30, Alex  wrote:
> > I'm new to Python and have been using IDLE 3.2.3 to experiment with
> > 
> > code as I learn. Despite being configured to use a 4 space
> > indentation
> > 
> > width, sometimes IDLE's "smart" indentation insists upon using
> > width-8
> > 
> > tabs.
> > 
> > 
> > 
> > From what I've been able to find on Google, this is due to a
> > 
> > shortcoming in Tk. While it's not that big a deal in the grand
> > scheme
> > 
> > of things, I think it looks like poop, and I'd like to change IDLE
> > to
> > 
> > use 4-space indentation instead of tabs for all indentation levels.
> > 
> > 
> > 
> > Is there any way for me to achieve what I want in IDLE, or do I
> > have to
> > 
> > start up my full-blown IDE if I want consistent 4-space indentation?
> > 
> > 
> > 
> > Alex
> 
> I think an IDE is better than IDLE. Try NINJA IDE.
> http://ninja-ide.org

Agreed. I like PyDev in Eclipse, but sometimes I just want to try out
something quick in the interpreter, to ensure I understand it or do a
quick experiment. Since indentation is syntactically significant in
Python, I think fixing the interpreter to produce good, readable,
cut-and-pasteable, and Pythonic code is more important than a cosmetic
feature, but less important than true bugs.

[toc] | [prev] | [next] | [standalone]


#28598

FromRamchandra Apte <maniandram01@gmail.com>
Date2012-09-06 06:54 -0700
Message-ID<085f6d52-9425-43c3-8d24-ee8bb66741ba@googlegroups.com>
In reply to#28595
On Thursday, 6 September 2012 19:13:23 UTC+5:30, Alex  wrote:
> Ramchandra Apte wrote:
> 
> 
> 
> > On Saturday, 25 August 2012 04:03:52 UTC+5:30, Alex  wrote:
> 
> > > I'm new to Python and have been using IDLE 3.2.3 to experiment with
> 
> > > 
> 
> > > code as I learn. Despite being configured to use a 4 space
> 
> > > indentation
> 
> > > 
> 
> > > width, sometimes IDLE's "smart" indentation insists upon using
> 
> > > width-8
> 
> > > 
> 
> > > tabs.
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > From what I've been able to find on Google, this is due to a
> 
> > > 
> 
> > > shortcoming in Tk. While it's not that big a deal in the grand
> 
> > > scheme
> 
> > > 
> 
> > > of things, I think it looks like poop, and I'd like to change IDLE
> 
> > > to
> 
> > > 
> 
> > > use 4-space indentation instead of tabs for all indentation levels.
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > Is there any way for me to achieve what I want in IDLE, or do I
> 
> > > have to
> 
> > > 
> 
> > > start up my full-blown IDE if I want consistent 4-space indentation?
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > Alex
> 
> > 
> 
> > I think an IDE is better than IDLE. Try NINJA IDE.
> 
> > http://ninja-ide.org
> 
> 
> 
> Agreed. I like PyDev in Eclipse, but sometimes I just want to try out
> 
> something quick in the interpreter, to ensure I understand it or do a
> 
> quick experiment. Since indentation is syntactically significant in
> 
> Python, I think fixing the interpreter to produce good, readable,
> 
> cut-and-pasteable, and Pythonic code is more important than a cosmetic
> 
> feature, but less important than true bugs.

Agree.

[toc] | [prev] | [next] | [standalone]


#28623

FromTerry Reedy <tjreedy@udel.edu>
Date2012-09-06 14:11 -0400
Message-ID<mailman.317.1346955120.27098.python-list@python.org>
In reply to#28595
On 9/6/2012 9:43 AM, Alex wrote:

>> On Saturday, 25 August 2012 04:03:52 UTC+5:30, Alex  wrote:
>>> I'm new to Python and have been using IDLE 3.2.3 to experiment with
>>> code as I learn. Despite being configured to use a 4 space
>>> indentation width,  sometimes IDLE's "smart" indentation insists
 >>> upon using width-8 tabs.

[snip]

> Agreed. I like PyDev in Eclipse, but sometimes I just want to try out
> something quick in the interpreter, to ensure I understand it or do a
> quick experiment.

You have two choices that come with the distribution: the console and 
IDLE. I prefer IDLE. IPython and other shells and IDEs are other choices.

> Since indentation is syntactically significant in
> Python, I think fixing the interpreter to produce good, readable,
> cut-and-pasteable, and Pythonic code is more important than a cosmetic
> feature, but less important than true bugs.

IDLE is not the interpreter. As I said before, the IDLE editor *already* 
does what you want. The IDLE Shell is intended mainly for single-line 
inputs. For compound statements, it does automatic indenting, unlike the 
console (at least not on Windows). It uses a tab to guarantee that the 
code is visually indented. It does not use secondary prompts because a) 
they would not line up anyway with proportional fonts and b) they would 
appear in cut and paste copies. This probably count be improved, and has 
been discussed, but someone has to volunteer to write a patch that shows 
that it can be improved without introducing negative consequences. I 
would test one if one appears.

For more than a three-line compound statement, I use the editor with a 
scratchpad file where editing is *much* easier. If the compound 
statement is a class or function definition, you need more statements 
anyway to actually exercise the definition. Hitting F5 to run is as easy 
as putting the cursor at the end of the statement and hitting Enter. And 
it runs multiple statements at once, not just one.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#28662

From"Alex" <foo@email.invalid>
Date2012-09-07 01:40 +0000
Message-ID<k2bjal$5e5$1@dont-email.me>
In reply to#28623
Terry Reedy wrote:

[snip]

> IDLE is not the interpreter. 

Fine, I meant shell. Thanks for fixing that for me.

> The IDLE Shell is intended mainly for single-line inputs. 

Maybe it should be limited to that, then. That way stoopid noobs like
me don't use it wrong and then use the wrong nomenclature to complain
about it.

> For more than a three-line compound statement, I use the editor with
> a scratchpad file where editing is much easier. 

Great tip, thanks. That's how I'll do it from now on.

[toc] | [prev] | [next] | [standalone]


#31518

FromFabio Zadrozny <fabiofz@gmail.com>
Date2012-10-17 12:10 -0300
Message-ID<mailman.2351.1350486665.27098.python-list@python.org>
In reply to#28595
On Thu, Sep 6, 2012 at 10:43 AM, Alex <foo@email.invalid> wrote:
> Ramchandra Apte wrote:
>
>> On Saturday, 25 August 2012 04:03:52 UTC+5:30, Alex  wrote:
>> > I'm new to Python and have been using IDLE 3.2.3 to experiment with
>> >
>> > code as I learn. Despite being configured to use a 4 space
>> > indentation
>> >
>> > width, sometimes IDLE's "smart" indentation insists upon using
>> > width-8
>> >
>> > tabs.
>> >
>> >
>> >
>> > From what I've been able to find on Google, this is due to a
>> >
>> > shortcoming in Tk. While it's not that big a deal in the grand
>> > scheme
>> >
>> > of things, I think it looks like poop, and I'd like to change IDLE
>> > to
>> >
>> > use 4-space indentation instead of tabs for all indentation levels.
>> >
>> >
>> >
>> > Is there any way for me to achieve what I want in IDLE, or do I
>> > have to
>> >
>> > start up my full-blown IDE if I want consistent 4-space indentation?
>> >
>> >
>> >
>> > Alex
>>
>> I think an IDE is better than IDLE. Try NINJA IDE.
>> http://ninja-ide.org
>
> Agreed. I like PyDev in Eclipse, but sometimes I just want to try out
> something quick in the interpreter, to ensure I understand it or do a
> quick experiment. Since indentation is syntactically significant in
> Python, I think fixing the interpreter to produce good, readable,
> cut-and-pasteable, and Pythonic code is more important than a cosmetic
> feature, but less important than true bugs.
> --


Actually, if you're in PyDev/Eclipse already, you can just use the
interactive shell that PyDev provides:
http://pydev.org/manual_adv_interactive_console.html

Cheers,

Fabio

[toc] | [prev] | [next] | [standalone]


#31521

From"Alex" <foo@email.invalid>
Date2012-10-17 15:34 +0000
Message-ID<k5mj5e$lmv$1@dont-email.me>
In reply to#31518
Fabio Zadrozny wrote:

> On Thu, Sep 6, 2012 at 10:43 AM, Alex <foo@email.invalid> wrote:
> > Ramchandra Apte wrote:
> > 
> >> On Saturday, 25 August 2012 04:03:52 UTC+5:30, Alex  wrote:
> >> > I'm new to Python and have been using IDLE 3.2.3 to experiment
> with >> >
> >> > code as I learn. Despite being configured to use a 4 space
> >> > indentation
> >> >
> >> > width, sometimes IDLE's "smart" indentation insists upon using
> >> > width-8
> >> >
> >> > tabs.
> >> >
> >> >
> >> >
> >> > From what I've been able to find on Google, this is due to a
> >> >
> >> > shortcoming in Tk. While it's not that big a deal in the grand
> >> > scheme
> >> >
> >> > of things, I think it looks like poop, and I'd like to change
> IDLE >> > to
> >> >
> >> > use 4-space indentation instead of tabs for all indentation
> levels.  >> >
> >> >
> >> >
> >> > Is there any way for me to achieve what I want in IDLE, or do I
> >> > have to
> >> >
> >> > start up my full-blown IDE if I want consistent 4-space
> indentation?  >> >
> >> >
> >> >
> >> > Alex
> > > 
> >> I think an IDE is better than IDLE. Try NINJA IDE.
> >> http://ninja-ide.org
> > 
> > Agreed. I like PyDev in Eclipse, but sometimes I just want to try
> > out something quick in the interpreter, to ensure I understand it
> > or do a quick experiment. Since indentation is syntactically
> > significant in Python, I think fixing the interpreter to produce
> > good, readable, cut-and-pasteable, and Pythonic code is more
> > important than a cosmetic feature, but less important than true
> > bugs.
> > --
> 
> 
> Actually, if you're in PyDev/Eclipse already, you can just use the
> interactive shell that PyDev provides:
> http://pydev.org/manual_adv_interactive_console.html
> 
> Cheers,
> 
> Fabio

Awesome. Exactly what I was looking for. Thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web