You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
I've noticed that typed_ast doesn't parse f-strings in the same way as the builtin ast module does. For instance in the following example, we only get a FormattedValue while the builtin ast module returns a JoinedStr:
import typed_ast.ast3 as typed_ast
import ast
f = typed_ast.parse("f'{a}'")
print(f.body[0].value)
f = ast.parse("f'{a}'")
print(f.body[0].value)
# going to print the following
<_ast3.FormattedValue object at 0x1040a09e8>
<_ast.JoinedStr object at 0x1040a0b00>
It would be great to have the same output as the builtin ast module. They both return a JoinedStr if the variable interpolation element is followed by one or more characters.
The text was updated successfully, but these errors were encountered:
Hi, when you say "the builtin ast module" what version of Python are you talking about? It maybe be that this is due to #60 not being complete. typed_ast is a fork of the 3.6.0 builtin ast module.
Since typed_ast was a fork of 3.6.0, we matched the 3.6.0 behavior which was inconsistent with later python versions. We have updated typed_ast to be based on 3.7.2, and the inconsistency is fixed.
(Though we don't have versions of typed_ast that are "bug-for-bug compatible" with 3.6.1+, which is a lacuna, if one that doesn't impact mypy's uses at least. If there's demand for such a thing, I'd be happy to review a PR that ported the patch in, though there would be serious questions about version numbers.)
Hey folks!
I've noticed that
typed_ast
doesn't parse f-strings in the same way as the builtinast
module does. For instance in the following example, we only get aFormattedValue
while the builtinast
module returns aJoinedStr
:It would be great to have the same output as the builtin ast module. They both return a
JoinedStr
if the variable interpolation element is followed by one or more characters.The text was updated successfully, but these errors were encountered: