Non-Indented python

David Bolen db3l at fitlinxx.com
Wed Nov 21 14:43:53 EST 2001


Jeff Shannon <jeff at ccvcorp.com> writes:

> Dave Cinege wrote:
> 
> > Rule of God:
> > The punishment for non-tab based indentation is death.
> 
> This is exactly backwards.
> 
> Tabs are wrong, because different editors will treat them differently.
> 
> Spaces are right, because a space is a space is a space, everywhere you
> go.

What Jeff said :-)

It's also useful to note that regardless of how you may choose to
display them, the Python parser is defined in the language reference
(section 2.1.7) to treat a hard tab as if it were an indentation to
the next multiple of 8 column.  So it's not treated as a fixed number
of spaces but moving to one of a fixed number of column positions.
Thus having an environment that displays hard tabs with some other
form of indentation risks looking different than the parser will see
the code, albeit its typically an innocuous error as long as
everything is kept consistent and only tabs are used.

Pure space based indentation (preferably at multiples of 4 columns by
convention) is best and least likely to cause problems during
exchanges.  Pure tab based indentation (preferably where a tab moves
to a multiple of 8 columns, but the parser would work with anything
consistent) is less preferable, and mixed tabs and spaces are evil and
just asking for trouble :-)

--
-- 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