tabs AND spaces to indent standard libs??

Huaiyu Zhu hzhu at localhost.localdomain
Tue Aug 8 16:40:04 EDT 2000


On Tue, 08 Aug 2000 15:32:06 GMT, jeffcjohnson at my-deja.com
<jeffcjohnson at my-deja.com> wrote: 
>I use tabs to indent my code, I set my editor to use tab widths of 4.
>I find it really frustrating when I copy code out of the libraries and
>it has 4 spaces for the first indent, and a tab for the next to
>simulate 8 spaces (or the first 4 spaces simulate half a tab?).  I've
>never looked at tabnanny, maybe then it would all make sense, but first
>I want to vent... What the hell are people thinking??!!
>
>To my way of thinking, if you want to use spaces to indent, use
>spaces.  I prefer tabs.  But why the hell would anyone want to make the
>code so incredibly messy by mixing the two.  When I load it into my
>editor, the indents get really messed up (visually) since my editor
>shows tabs at width of 4 so they indent at the same level as the 4
>spaces.
>
>Anyone have an explanation for this?  Any chance of getting future
>coding style guides to use ALL spaces or ALL tabs?
>

The explanation is that the coder 
- uses the insane default setting of tab=8
- prefers the sane indentation of 4 spaces
- still wants to use tab to help typing
- but forgets to do untabify afterwards

IMO, tab=8 is more convenient if one uses text editor to do full screen
tabular editing (8*8=64), while tab=4 is more convenient if one uses it only
for indentation (4*4=16).  Bases on its main usage today, tab=4 is superior.

The big problem is that a lot of tools automatically assume tab=8, based on
ancient conventions.  If one day browsers could change tabwidth, say, the
situation would be quite different.

I support setting the -tt switch as default by anyone who publishes codes.
In Linux alias python="python -tt" would do.

Huaiyu



More information about the Python-list mailing list