[sugar] Python coding conventions
Ian Bicking
ianb
Mon Oct 2 11:31:05 EDT 2006
Dan Williams wrote:
> There's always modelines, and as long as everyone agrees that a tab is
> the same width (enforced with modelines and whatnot), the code is always
> readable anyway. It's completely the same problem. If you choose
> spaces, everyone has to agree on (a) using spaces in the first place,
> and (b) agree on an indent width, either 4 or 8 spaces. If you choose
> tabs, everyone has to agree on (a) using tabs in the first place, and
> (b) agree on a tab width, either 4 or 8 "spaces". It's exactly the same
> choice either way, and making somebody else use spaces is exactly the
> same thing as making somebody use tabs. Obviously the world would be a
> better place if everyone had exactly the same opinions... :)
FWIW my tab stops are at 8, and the code is misindented in places as a
result (usually function declarations). And my editor (Emacs) doesn't
skip leading spaces or treat them as blocks, but it's never bothered me
(it does otherwise handle indentation well). I guess I use
Ctrl-Left/Right for much of my navigation anyway.
The issue I see is that tabs and spaces look identical, and so are
easily confused as a reader. There's other problems, like tabs getting
lost of expanded. Entering a tab in a browser textarea can be hard.
When I paste code into Thunderbird it expands tabs to spaces. Generally
tabs seem like they should be nice -- everyone uses exactly one tab per
indentation level, you can set the width however you want, etc -- but in
practice there seem to be more problems than advantages.
Generally speaking visually identical but semantically different
characters seem really bad -- especially for beginner programmers (for
whom this code should be accessible) -- and certainly the space
character isn't going away...
--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
More information about the Sugar-devel
mailing list