[issue33422] Fix and update string/byte literals in help()
Serhiy Storchaka
report at bugs.python.org
Fri May 4 11:25:19 EDT 2018
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
I don't think we need to support prefixes without quotes or with triple qoutes. 'ur' is not valid prefix. Using simplified code from tokenize:
_strprefixes = [''.join(u) + q
for t in ('b', 'r', 'u', 'f', 'br', 'rb', 'fr', 'rf')
for u in itertools.product(*[(c, c.upper()) for c in t])
for q in ("'", '"')]
Or you can use tokenize._all_string_prefixes() directly:
_strprefixes = [p + q
for p in tokenize._all_string_prefixes()
for q in ("'", '"')]
But it may be simple to just convert the string to lower case before looking up in the symbols dict. Then
_strprefixes = [p + q
for p in ('b', 'r', 'u', 'f', 'br', 'rb', 'fr', 'rf')
for q in ("'", '"')]
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33422>
_______________________________________
More information about the Python-bugs-list
mailing list