Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Dec 3 23:48:40 EST 2001


Steve Lamb wrote:
> 
> some_dict = {'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'},
>              'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'},
>              'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'},
>              'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'},
>              'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'}
>             }
> 
>     You get it yet?  You finally understand that preference SCREWS UP THE
> INTENT AND READABILITY OF THE ABOVE EXAMPLE WHICH IS NOT ALL THAT UNCOMMON?
> Yeesh.  3 days now and you still haven't address that real and valid concern!

This concern *has* been addressed, by suggesting the
above be written as

  some_dict = {
    'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'},
    'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'},
    'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'},
    'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'},
    'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'}
  }

Also, there seems to be some confusion in this discussion
about two quite different kinds of formatting: Python
block-indentation on the one hand, and cosmetic lining-up
on the other. People arguing in favour of tabs are talking
only about the former, not the latter.

If you need to do cosmetic lining-up, the best thing is
to use whatever your current convention is for block
indentation up to the syntactic level of the statement,
and then use spaces-only after that. It still won't work
if viewed with a proportional font, but it's the best
that can be done using plain ASCII.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list