[Python-Dev] Triple-quoted strings and indentation

Andrew Durdin adurdin at gmail.com
Wed Jul 6 11:36:51 CEST 2005


On 7/6/05, Terry Reedy <tjreedy at udel.edu> wrote:
> 
> Doc strings, first meant for the code reader, need to be where they are.
> They also come before the code itself, so don't interfere.

Doc strings are really not an issue, due to the conventions for
processing whitespace in them (and also the fact that their primary
use is for the reader of the code, even before any automated
processing).
 
> > -- it's a wart:
> 
> That is rather extreme, and is definitely an opinion.

My opinion, certainly.  However, I think the fact that workarounds for
the leading whitespace issue are needed (PEP 257, textwrap.dedent("""\
<text begins on next line>)) points to it being more than that. But of
course that is also my opinion :-)

> And what if I want the leading whitespace left just the way I carefully put
> it?

You can still put leading whitespace as you want it -- there would
just be a slightly different convention to follow -- I'll post what I
wrote up so you can see the whole proposal: better than me repeating
it all in bits.

> And what of existing code dependent on literals being as literal as
> they currently are?

There would be some breakage, certainly -- though I believe it would
be quite little.

> I think the soonest this could be considered is Python
> 3.0.

Quite likely so.

Andrew


More information about the Python-Dev mailing list