[Python-ideas] Multi-line string indentation
Christopher Barker
pythonchb at gmail.com
Fri Feb 8 14:56:02 EST 2019
not that anyone asked, but I"d only support:
> 2a) Adding a str.dedent() method
and maybe:
> 2b) Creating a constant-folding peephole optimization for methods on
immutable literals
and frankly, it's a much lighter lift to get approval than:
1) Creating a new type of string literal which compiles to a dedented
form of multiline string
Also -- more useful -- dedent() is helpful for non-literals as well.
Other than docstrings, the case for literals is pretty small, and
docstrings are already auto-cleaned up.
> in all of the code I've ever written in Python (and that's quite a
> > lot...) I've never actually had a case where I this feature would have
> > made a significant difference to the code I wrote.
exactly -- I do have one case -- but that's for an instructional exercise
where we are keeping things simple -- in operational code that string would
have been in a file, or database, or ....
-CHB
--
Christopher Barker, PhD
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190208/fbe20714/attachment.html>
More information about the Python-ideas
mailing list