Waffling between Python and Ruby

David Bolen db3l at fitlinxx.com
Wed Jun 14 21:57:29 EDT 2000


(dropped comp.lang.ruby since the whitespace is Python only)

hzhu at knowledgetrack.com (Huaiyu Zhu) writes:

> If you use emacs:
> 
> C-x h M-x tabify
> 
> will tabify the whole buffer.  I always do this when doing copy and paste
> from news groups, and do an untabify the other way round.  This is because
> the default tab space is 4 in emacs (which is sane) but 8 everywhere else.

The default tab stop for a physical TAB character in Emacs is 8, which
is the most sane value.  A TAB character in an Emacs buffer is, by
default, treated as moving to the next boundary that is a multiple of
8 by default.  The tab stop width can in theory be overridden (see
variables default-tab-width and buffer-local tab-width), but doing so
is just plain evil.

Instead of changing tab stops, it is far preferable to set the
indentation for coding in various modes to anything you want (and
Python mode will default to 4).  When inserting indentation, Emacs
will use a mixture of TABs and spaces to get you where you need to be
in the most efficient manner, assuming the 8-character TAB multiple.

Or to put it more succinctly - the default Emacs interpretation of the
TAB physical character and Python's interpretation are the same, and
you should be perfectly safe letting Emacs mix TABs and spaces for
Python code, unless you've reset the default tab stops, which as I
mentioned above would be evil :-)

That said, the Python mode keeps everything with spaces anyway.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list