On Mon, 2008-10-20 at 13:29 +0000, Steven D'Aprano wrote: > On Mon, 20 Oct 2008 11:01:19 +0200, Bruno Desthuilliers wrote: > > > Steven D'Aprano a écrit : > >> On Sun, 19 Oct 2008 19:03:29 +0200, Bruno Desthuilliers wrote: > >> > >>> Steven D'Aprano a écrit : > >>> > >>> (snip) > >>> > >>>> You can use tabs, or spaces. If you use spaces, you can choose 4 > >>>> spaces, or 8, or any number, > >>> By all means, make it 4 spaces - that's the standard. > >> > >> It's *a* standard. I believe it is the standard for the Python standard > >> library, but there are other standards. > > > > I can't remember having seen any other "standard" so far. > > > How about PEP 8? It's not even hidden deep in the bowels of the PEP -- > it's almost at the top. > http://www.python.org/dev/peps/pep-0008/ > > "For really old code that you don't want to mess up, you can continue to > use 8-space tabs." >
Fair, but limited to old code, so doesn't apply to instructions for new code. > > Then there's string.expandtabs(): > > expandtabs(...) > S.expandtabs([tabsize]) -> string > > Return a copy of S where all tab characters are expanded using spaces. > If tabsize is not given, a tab size of 8 characters is assumed. > The default for a tab does not imply anything about how python code should be indented. > > Here's Jamie Zawinski: > http://www.jwz.org/doc/tabs-vs-spaces.html > > "On defaultly-configured Unix systems, and on ancient dumb terminals and > teletypes, the tradition has been for the TAB character to mean ``move to > the right until the current column is a multiple of 8.'' (As it happens, > this is how Netscape interprets TAB inside <PRE> as well.) This is also > the default in the two most popular Unix editors, Emacs and vi." > Again, refers to the interpretation of a tab, rather than indentation conventions. > > This page is a little old (2002), but it states that the standards for > OpenBSD and Linux (presumably the kernels) are 8 space indents: > > http://xarg.net/writing/tabs > Not python. I think when Bruno says it's *the* standard, we can assume he means "for python." > Here's a style guide that recommends 2, 3 or 4 space indents: > > http://www.cs.bris.ac.uk/Teaching/Resources/COMS12100/style/ > Again, it's for java and C, not python. > > And of course, whenever there's a difference of opinion, we can turn to > the ultimate source of all knowledge: Googlefight! *wink* > > http://www.googlefight.com/index.php?lang=en_GB&word1=tab+8 > +spaces&word2=tab+4+spaces > Nearly 50 million hits for "tab 8 spaces" versus a piddly 762 thousand > hits for "tab 4 spaces". > > And I still don't care how many spaces are in a tab. ;D Cheers, Cliff -- http://mail.python.org/mailman/listinfo/python-list