Using tabs instead of spaces in IDLE?

Cliff Wells logiplexsoftware at earthlink.net
Wed Feb 13 21:50:58 EST 2002


On Thu, 14 Feb 2002 02:21:03 GMT
Tom Bryan wrote:

> Is there a way to use tabs exclusively for indentation in IDLE? 
Basically, 
> I'd like tabwidth to equal identwidth while permitting developers to
adjust 
> the indentwidth.  I see that AutoIndent.py says

I don't use IDLE, so I can't answer your question (I use XEmacs).  However,
I've long been a hardcore tabber but recently decided to uses spaces
instead.  I've found through experience that this is probably the best way
to go when coding in Python.  Further, since Emacs (and I've heard, vim)
support treating groups of spaces as a single tab (tab inserts n number of
spaces, backspace takes you back n spaces), there really isn't much
functional difference between the two when editing.

So why change?  Because I've found that most Python code you will find uses
spaces.  Certainly all the code in the standard library does. 
Cutting/pasting will go much easier in the typical case than if you use
tabs.  If you decide to edit a python file you've gotten from the standard
library or from a contributed source, you will have to remember to indent
with spaces and not automatically reach for the tab key.  If you forget,
you'll have an invisible error in your file (although the traceback will
usually lead you quickly to it).  I've had this happen enough that I
finally capitulated and made the switch.  End result: editing my code is
about the same and editing other's code is far easier.

Regards,

-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308  (800) 735-0555 x308




More information about the Python-list mailing list