Todd wrote:
On Tue, Oct 22, 2019 at 3:54 PM Steve Jorgensen stevej@stevej.name wrote:
See 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()
No. It really doesn't provide much benefit beyond that.
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 ".
Actually, in Ruby, the surrounding character pair can be pretty much anything `, and in practice, curly braces are often used. From https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#The_%_Notatio... :
Any single non-alpha-numeric character can be used as the delimiter, `%[including these]`, `%?or these?`, `%~or even these things~`. By using this notation, the usual string delimiters `"` and `'` can appear in the string unescaped, but of course the new delimiter you've chosen does need to be escaped. However, if you use `%(parentheses)`, `%[square brackets]`, `%{curly brackets}` or `%<pointy brackets>` as delimiters then those same delimiters can appear unescaped in the string as long as they are in balanced pairs…