Python "why" questions

Kai Borgolte Kai.Borgolte at gmx.de
Fri Aug 20 03:09:16 EDT 2010


Russ P. wrote:

>> A simple example: Using zero-based indexing, suppose you want to indent
>> the string "spam" so it starts at column 4. How many spaces to you
>> prepend?

No, you won't want to indent a string so it starts at column 4. You
simply want to indent the string by four spaces. Like in PEP 8:

/Use 4 spaces per indentation level./

> 0123456789
>     spam

And of course your text editor will number the columns beginning with
one, so the string starts at column 5.

123456789
    spam
-- 
Kai Borgolte, Bonn



More information about the Python-list mailing list