Re:Tabs or spaces – Parsing a 1B files among 14 programming ...
by akerro on Wednesday August 31, 2016 @08:22AM
(#12397720)
or python, or rust.
[ Parent
| on HN ]
Re:Tabs or spaces – Parsing a 1B files among 14 programming ...
by pluma on Wednesday August 31, 2016 @08:41AM
(#12397832)
Python doesn't care either way as long as indentation is consistent (though there's a common misunderstanding that Python cares). However PEP-8 specifies that code should be indented using 4 spaces and editors should be configured to render tabs as 8 spaces (likely to make mixed tabs & spaces really obvious). But PEP-8 also specifies that code should follow whatever is the coding standard in a given project.
IOW, Python is actually far more pragmatic than most people (including most Python programmers) think. It just has a culture that strongly advocates following the rules (i.e. PEP-8 and PEP-20).
Re:Tabs or spaces – Parsing a 1B files among 14 programming ...
by deniska on Wednesday August 31, 2016 @09:53AM
(#12398273)
Python treats a tab character as the amount of spaces needed to go into the nearest multiple of 8 column. With py2 ability to mix different indentation as far as it amounts to the same column, you can format your code in pretty interesting ways.
Re:Tabs or spaces – Parsing a 1B files among 14 programming ...
by yxhuvud on Wednesday August 31, 2016 @09:56AM
(#12398297)
Well, python most certainly do care in the case when tabs and spaces are used inconsistently. In python2 you could even redefine tab width inline like https://gist.github.com/yxhuvud/2006599 .