[Python-ideas] Syntax for dedented strings
fuzzyman at gmail.com
Tue Aug 16 23:33:26 CEST 2011
I'm sure this will be shot down , but it annoys me often enough that I'm
going to suggest it anyway. :-)
A recent tweet of Raymond's reminded me how useful textwrap.dedent() is for
dedenting triple quoted strings in code blocks:
this_string = textwrap.dedent("""\
Here is some indented text.
that dedent will handle for us."""
Unfortunately that doesn't work for docstrings as they must be string
literals. It is compounded by the fact that you can't even create the
docstring for a class and manually assign it later. (Why not? But that's
How about *another* string prefix for dedented strings:
This text will be,
thank you very much.
All the best,
 Because of the -100 rule as much as anything else, which applies doubly
to features requiring new syntax
May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas