It would radically change the meaning of every existing multi-line string.
That is an enormous backwards-compatibility break.  It might work as a
__future__ import, though.

On Sat, Mar 31, 2018, 13:03 Marius Räsener <m.raese...@gmail.com> wrote:

> Hey David,
>
> hm, that's actually a nice way to solve this too I guess, besides the
> additional import and "string literal".
>
> but as I answered to robert before (did it wrong with who to answer,
> correct it just now so the mailing-list has the answer, too) was, that I
> don't have a string literal in mind for this.
>
> Like I don't see a reason why this couldn't be the default thing for all
> string literals?
>
> again, the Idea is just to use the closing quotes to determine the
> indentation length ...
>
> 2018-03-31 18:51 GMT+02:00 David Mertz <me...@gnosis.cx>:
>
>> I can currently write:
>>
>> from textwrap import dedent as d
>> print(d("""
>>     I am
>>     A Line
>> """))
>>
>> It doesn't feel like these hypothetical d-strings are with new syntax.
>>
>> On Sat, Mar 31, 2018, 11:49 AM Robert Vanden Eynde <robertv...@gmail.com>
>> wrote:
>>
>>> So yes, currently you just do :
>>>
>>> import textwrap
>>>
>>> print(textwrap.dedent("""
>>>     I am
>>>     A Line
>>> """))
>>>
>>> So you'd want a string litteral ?
>>>
>>> print(d"""
>>>     I am
>>>     A Line
>>> """)
>>>
>>> Le sam. 31 mars 2018 à 17:06, Ryan Gonzalez <rym...@gmail.com> a écrit :
>>>
>>>> I have to admit, regardless of how practical this is, it would surely
>>>> get rid of a ton of textwrap.dedent calls all over the place...
>>>>
>>>> On March 31, 2018 9:50:43 AM Marius Räsener <m.raese...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hey List,
>>>>>
>>>>> this is my very first approach to suggest a Python improvement I'd
>>>>> think worth discussing.
>>>>>
>>>>> At some point, maybe with Dart 2.0 or a little earlier, Dart is now
>>>>> supporting multiline strings with "proper" identation (tried, but I can't
>>>>> find the according docs at the moment. probably due to the rather large
>>>>> changes related to dart 2.0 and outdated docs.)
>>>>>
>>>>> What I have in mind is probably best described with an Example:
>>>>>
>>>>> print("""
>>>>>     I am a
>>>>>     multiline
>>>>>     String.
>>>>>     """)
>>>>>
>>>>> the closing quote defines the "margin indentation" - so in this
>>>>> example all lines would get reduces by their leading 4 spaces, resulting 
>>>>> in
>>>>> a "clean" and unintended string.
>>>>>
>>>>> anyways, if dart or not, doesn't matter - I like the Idea and I think
>>>>> python3.x could benefit from it. If that's possible at all :)
>>>>>
>>>>> I could also imagine that this "indentation cleanup" only is applied
>>>>> if the last quotes are on their own line? Might be too complicated though,
>>>>> I can't estimated or understand this...
>>>>>
>>>>> thx for reading,
>>>>> Marius
>>>>>
>>>>> _______________________________________________
>>>>> Python-ideas mailing list
>>>>> Python-ideas@python.org
>>>>> https://mail.python.org/mailman/listinfo/python-ideas
>>>>> Code of Conduct: http://python.org/psf/codeofconduct/
>>>>>
>>>>>
>>>> --
>>>> Ryan (ライアン)
>>>> Yoko Shimomura, ryo (supercell/EGOIST), Hiroyuki Sawano >> everyone else
>>>> https://refi64.com/
>>>>
>>>> _______________________________________________
>>>> Python-ideas mailing list
>>>> Python-ideas@python.org
>>>> https://mail.python.org/mailman/listinfo/python-ideas
>>>> Code of Conduct: http://python.org/psf/codeofconduct/
>>>>
>>> _______________________________________________
>>> Python-ideas mailing list
>>> Python-ideas@python.org
>>> https://mail.python.org/mailman/listinfo/python-ideas
>>> Code of Conduct: http://python.org/psf/codeofconduct/
>>>
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas@python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to