On Tue, Oct 22, 2019 at 3:54 PM Steve Jorgensen <stevej@stevej.name> wrote:
See https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#The_%_Notation for what Ruby offers.

For me, the arrays are the most useful aspect.

    %w{one two three}
    => ["one", "two", "three"]

I did a search, and I don't see that this has been suggested before, but I might have missed something. I'm guessing I'm not the first person to ask whether this seems like a desirable feature to add to Python.

I am not seeing the advantage of this.  Can you provide some specific examples that you think would benefit from this syntax? 

For the example you gave, besides saving a few characters I don't see the advantage over the existing way we have to do that:

'one two three'.split()

Python usually uses [ ] for list creation or indexing.  Co-opting it for a substantially different purpose of string processing like this doesn't strike me as a good idea, especially since we have two string identifiers already, ' and ".

Python does have something similar in function although different in syntax, its string prefixes.  For example f-strings, r-strings, byte literals, etc.  There have been proposals for supporting custom string prefixes, but none have gone anywhere.  Other hard-coded string prefixes could, in principle, be done, but a strong case would need to be made for them. 

If we went with string prefixes, the only one I could see maybe having any traction would be a regex one, but I personally wouldn't see that as being common enough to warrant it.  Converting strings to names is something I think should be discouraged rather than encouraged (we have dictionaries to handle arbitrary names), shell commands are complicated enough that I would think having a dedicated function is necessary and I think it would be an abuse of string literals, and the others duplicate features python already has as far as I can tell.

So I would be -100 on using [ ]  for strings in any way, +0 on a regex string prefix, and -1 on all the other corresponding string prefixes.