[Python-ideas] Syntax for dedented strings
ben+python at benfinney.id.au
Tue Aug 16 23:58:36 CEST 2011
Michael Foord <fuzzyman at gmail.com> writes:
> How about *another* string prefix for dedented strings:
> class Thing(object):
> This text will be,
> nicely dedented,
> thank you very much.
""" This literal string contains leading and trailing whitespace.
It also is indented. But none of that will show up when the
docstring is processed and presented to the user.
Because it is a docstring that conforms to PEP 257, the
indentation will be handled properly by PEP-257 conformant
gives the specification for how indentation shall be handled by
code that processes Python docstrings.
The programmer inspecting the value of ‘__doc__’ will still see
the leading, trailing, and indenting whitespace; but the
programmer doing so isn't the recipient of the docstring as a
So I don't see what problem there is to be solved.
\ “Guaranteed to work throughout its useful life.” —packaging for |
`\ clockwork toy, Hong Kong |
More information about the Python-ideas