On 8/12/2019 6:34 AM, Eric V. Smith wrote:
On 8/12/2019 2:52 AM, Greg Ewing wrote:
Eric V. Smith wrote:
I'm not in any way serious about this. I just want people to realize how many wacky combinations there would be.

It doesn't matter how many combinations there are, as long as
multiple prefixes combine in the way you would expect, which
they do as far as I can see.

In general I agree, although there's some cognitive overhead to which combinations are valid or not. There's no "fu" strings, for example.

But for reading code that doesn't matter, so your point stands.

Please no more combinations. The presence of both legal and illegal combinations is already a mild nightmare for processing and testing. idlelib.colorizer has the following re to detest legal combinations

    stringprefix = r"(?i:r|u|f|fr|rf|b|br|rb)?"

and the following test strings to make sure it works

"# All valid prefixes for unicode and byte strings should be colored.\n"
"'x', '''x''', \"x\", \"\"\"x\"\"\"\n"
"r'x', u'x', R'x', U'x', f'x', F'x'\n"
"fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n"
"b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x', rB'x',Rb'x',RB'x'\n"
"# Invalid combinations of legal characters should be half colored.\n"
"ur'x', ru'x', uf'x', fu'x', UR'x', ufr'x', rfu'x', xf'x', fx'x'\n"

Or, if another prefix is added, please add an expanded guaranteed-correct regex to the stdlib somewhere.

--
Terry Jan Reedy
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EVDDJEA25YKPTKX6RZY55Q66NJWTOH3A/

Reply via email to