Indented multi-line strings (was: "Data blocks" syntax specification draft)

Dan Strohl D.Strohl at F5.com
Wed May 23 13:35:40 EDT 2018



> 
> How about we instead just use the rules from PEP 257 so that there aren't two
> different sets of multi-line string indentation rules to have to remember?
> 
> https://www.python.org/dev/peps/pep-0257/#handling-docstring-indentation
> 


I like that, better to be closer to the existing standards. One could then see this as an extension of the doc-strings.

> Also, how about using a string prefix character instead of making quad-quote
> meaningful? Apart from being hard to visually distinguish from triple-quote,
> this would break existing triple-quote strings that happen to start with the
> quote character, e.g ''''What?' she asked.'''
> 
> I don't know if 'i' would be the right prefix character for this, but it's unused
> and is short for 'indented':
> 

Or go with a different character (or set of characters) altogether... like $, \, ~, ^, < ? (good catch on it  catching on ''''hello' I am not in this''', I forgot about that behavior)

I'm not against a prefix character, just throwing out alternatives. (though, to me, the 'i' indicated int)





More information about the Python-list mailing list