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

Peoter Veliki peoter_veliki at hotmail.com
Tue Dec 4 00:28:53 EST 2001


Anything you want to line up must be at the same indent level.  In the
example below, however many tabs the first line has in front of it, each of
the other lines below must also have the same number of tabs and the use
spaces to finishing lining everything up.  If you do this it will line up on
any editor.


"Greg Ewing" <greg at cosc.canterbury.ac.nz> wrote in message
news:3C0C55A8.EAD03FD5 at cosc.canterbury.ac.nz...
> 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
> --
> http://mail.python.org/mailman/listinfo/python-list
>





More information about the Python-list mailing list