indendation question

Peter Hansen peter at engcorp.com
Mon Jan 5 17:43:15 EST 2004


Sean 'Shaleh' Perry wrote:
> 
> On Thursday 25 December 2003 19:32, km wrote:
> > Hi all,
> >
> > What is the standard and recommended way of indendation one should get to
> > use in python programming ? is it a tab or 2 spaces or 4 spaces ? i am
> > confused. kindly enlighten
> >
> > thanks,
> > KM
> 
> Well the "official" standard can be seen in the python files distributed with
> python -- 4 spaces.
> 
> That said, Python will use any whitespace you want as long as you are
> consistent.  3 spaces, a tab, whatever.

Well, *almost* any whitespace. :-)

>>> import string
>>> string.whitespace
'\t\n\x0b\x0c\r '

Of those, only '\t' and ' ' are going to be much help, I think, when trying
to indent.  Linefeed, carriage return, vertical tab, and form feed are
most likely not well supported yet. ;-)

-Peter



More information about the Python-list mailing list