On Mon, Jul 01, 2013 at 06:22:25PM +0200, Philipp A. wrote:
2013/7/1 Guido van Rossum guido@python.org
That‘s a compelling argument. Let’s do it. (Assuming the definition of exactly how to indent or dedent is not up for discussion — if there are good reasons to disagree with textwrap now's the time to bring it up.)
I don’t know if it’s a good reason, but I’m of the opinion that the required backslash at the beginning of to-be-dedented string is strange:
It's not *required*. It's optional. You can live with an extra blank line: s = """ first line second line ... """ or you can manually indent the first line: s = """ first line second line ... """ or you can slice the string before calling dedent, or, in my opinion the neatest and best solution, just escape the opening newline with a backslash: s = """\ first line second line ... """ But in any case, I don't like the idea of making the proposed dedent method be a DWIM "format strings the way I want them to be formatted" method. It's called "dedent", not "dedent and strip leading newlines". I'm okay in principle with dedent taking additional arguments to customize the behaviour, such as amount of whitespace to keep or a margin character, so long as the default with no args matches textwrap.dedent. -- Steven