On Sun, Oct 19, 2008 at 06:05:08PM +0000, Jorgen Grahn wrote: > Doesn't pretty much everyone use spaces and a four-position indent?
I can't speak for everyone, or even "pretty much everyone"... but I know of several people who favor the idea of "indent with tab, align with space." The advantage to this scheme is that anyone using a half-sane editor can very easily change the level of indentation to their preference, meanwhile keeping the rest of the code aligned properly (though this may well interfere with keeping line lengths to 80 columns, or some other decided-upon number). I favor this myself actually, though I rarely use it for Python code I write, because that almost invariably needs to work with someone else's code who insists on the "standard" you mentioned. I know plenty of people who prefer a full 8-column indent, feeling that it makes indentations (and therefore the logical blocks wich the indentation is meant to indicate) much clearer, though most of them are primarily C coders. Some switch to 4 for python, and some prefer to keep 8 for pretty much everything they write. > I don't think I've ever come across any half-decent Python code > which didn't follow that convention. I have. :) Unless one defines a lack of tabs as a criteria of "half-decent Python code" -- which I obviously don't. > [0] This is an old and tedious topic ... This is very true... though clearly to anyone who hasn't encountered it before, it is rather new. > my view on TABs is that they are useless iff they aren't > rendered the same way everywhere. The size 8 is hard-coded into > terminals, printers and programs since ancient times; thus > anything else is wrong. This, on the other hand, is quite false -- not your opinion, perhaps, but all of the facts you've put forth in support of it. The tab size of nearly every tty device I've interacted with in the last 25 years *defaulted* to 8, but is configurable using any of various terminal control programs, such as tabs, stty, etc. (though I wouldn't know how to do this on Windows, or if it's even possible/relevant)... The utility of adjustable tabs is what I already stated above. I'm not saying you should change it... just that it is very much *not* hard-coded. In fact, most of the terminal devices I've used let you set arbitrary tab stops at whatever column positions you like. Occasionally useful, though not to me personally. One thing is for sure: it's essential that whatever formatting you decide to use, everyone touching that code needs to use the same one, or else the result is an annoying mess. Vim (and quite probably other editors) solves this by providing a way to set the options in the file you're editing, which is one of many reasons why I favor it over anything else. For example, at the top of your file: #!/usr/bin/python # vim:ts=4:sw=4:expandtab Though of course, using this kind of mechanism quickly becomes gross if everyone is using a different editor, and they all support a similar but different mechanism for doing so. -- Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0x81CFE75D
pgpWonPLlq6C1.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list