bpo-36280: Add Constant.kind field by gvanrossum · Pull Request #12295 · python/cpython (original) (raw)
Do you need indications for triple-quote strings?
Not for this use case.
Why do you need 'b' for bytes if you can use
isinstance(node.value, bytes)
?
Good point. (I believe I was just copying that behavior from the Python 2 part of typed_ast, where it was considered useful.)
What kind should be for concatenated '' and u'' literals? E.g.:
'abc' u'def'
.
For my use case it doesn't really matter; I'd rather not waste time trying to do something smarter than looking for the first segment.
Here's what I propose to do. I'll set it to 'u'
if the first segment starts with 'u'
(since ru'...'
isn't allowed anyway), else I'll set it to NULL/None.
Sadly none of that helps me fixing the unit tests -- I believe the problems are all caused by the changes to the repr()
of ast.Constant
.