Author serhiy.storchaka
Recipients gregory.p.smith, mbussonn, pablogsal, remi.lapeyre, rhettinger, serhiy.storchaka, steven.daprano
Date 2019-05-20.16:42:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1558370571.06.0.805831845594.issue36906@roundup.psfhosted.org>
In-reply-to
Content
While the string method works pretty well, I do not think this is the best way. If 98% of multiline string will need deindenting, it is better to do it by default. For those 2% that do not need deintentation, it can be prohibited by adding the backslash followed by a newline at first position (except the start of the string). For example:

smile = '''\

 XX
 XX      X
          X
    XXX   X
          X
 XX      X
 XX

\
'''

Yes, this is breaking change. But we have import from __future__ and FutureWarning. The plan may be:

3.9. Implement "from __future__ import deindent".
3.11. Emit a FutureWarning for multiline literals that will be changed by dedending if "from __future__ import deindent" is not specified.
3.13. Make it the default behavior.
History
Date User Action Args
2019-05-20 16:42:51serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, gregory.p.smith, steven.daprano, mbussonn, pablogsal, remi.lapeyre
2019-05-20 16:42:51serhiy.storchakasetmessageid: <1558370571.06.0.805831845594.issue36906@roundup.psfhosted.org>
2019-05-20 16:42:51serhiy.storchakalinkissue36906 messages
2019-05-20 16:42:50serhiy.storchakacreate