Soni L. writes:

 > however, I bring up again the original use-case which has nothing to do 
 > with textwrap.dedent, or nested indentation.

 > Currently you'd have to write it as:

 > foo = (
 >      "This is the help page for foo, a command "
 >      "with the following subcommands:\n"
 >      "    bar - A very useful subcommand of foo "
 >      "and probably the subcommand you'll "
 >      "be using the most.\n"
 >      "    baz - A simple maintenance command "
 >      "that you may need to use sometimes."
 > )

Which isn't at all bad, though I would write it:

foo = (
     "This is the help page for foo, a command"
     " with the following subcommands:"
     "\n    bar - A very useful subcommand of foo"
     " and probably the subcommand you'll"
     " be using the most."
     "\n    baz - A simple maintenance command "
     " that you may need to use sometimes."
)

It's a little less beautiful, I guess, but it's the most readable and
proofreadable of all the idioms to my eye.  But then, I read a *lot*
of RFC 822 headers. :-)

 > And I think this sucks.

This is not a hill I'd be willing to die on, to be honest.  All of the
idioms are more or "less ugly, and '\z' is not an improvement on most
of them.

Aside to Chris: d"" or similar to implicitly invoke textwrap.dedent
has been brought up at least once in the past (sorry, no cite
offhand), and it got the reply you would expect: YAGNI since
textwrap.dedent already exists, and if you want a prefix that's less
heavy, "from textwrap import dedent as _" (or other short identifier)
is your friend.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/B6DFZWAQVX3MY4C66WOX6W3RZLTHYYK3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to