[GRASS-dev] [GRASS GIS] #1832: Python scripts are with mixed tabs and spaces
GRASS GIS
trac at osgeo.org
Wed Apr 10 05:27:33 PDT 2013
#1832: Python scripts are with mixed tabs and spaces
-------------------------+--------------------------------------------------
Reporter: klo | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Python | Version: unspecified
Keywords: indent | Platform: Unspecified
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by glynn):
Replying to [comment:8 hamish]:
> Replying to [ticket:1832 klo]:
> > Mixing tabs and spaces is not good idea:
http://www.python.org/dev/peps/pep-0008/#tabs-or-spaces
>
> annoyingly, it asserts it is so but does not explain why. is it just
that lots of people submit code after editing with braindead text editors,
or is it something inherent in the python language which makes it so...?
Python uses indentation to determine block boundaries, so indentation
matters.
Some text editors treat tab stops as configurable, but there's no way for
the Python interpreter to know how the editor is configured, so it assumes
that tab stops are every 8 columns. If you use an editor which is set to
use e.g. 4-column tabs, then a line indented by 4 spaces and a line
indented by a tab will appear to be at the same indentation level, but
Python will treat the latter as indented more than the former.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1832#comment:10>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list