On Wed, Jun 17, 2020 at 09:23:04AM -0700, Christopher Barker wrote:

> Though now that you mention is, I really dont like the \z idea -- I just
> don't see the point. But a simiple way to call (and pre-process detent
> would be nice:
> 
> nicest = d"""foo
>                 bar
>                 baz"""
> 
> I  believe that's been proposed on this lists before -- not sure if it
> petered out, or was rejected.

There's an enhancement on b.p.o to make dedent a string method:

https://bugs.python.org/issue36906

Aside from being more convenient to use, it would then allow the 
peep-hole optimizer to apply the text dedent at compile-time.

At the moment \z resolves to a literal backslash followed by a z. So 
this is a backwards-compatibility breaking change.

    # Python 3.8
    py> print("abcd\z    xy")
    <stdin>:1: SyntaxWarning: invalid escape sequence \z
    abcd\z    xy

As you can tell from the SyntaxWarning, there is a plan to eventually 
make unrecognised escapes an error. Once that occurs, we can start 
proposing new escapes, but until then, I think any proposal for a new 
escape sequence is dead in the water.


-- 
Steven
_______________________________________________
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/7NYNP4PR3JFB3MQ5GQEF22KSLKBXLWHB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to