-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
f-string support #2265
Comments
That sounds like a reasonable plan. Do you feel comfortable with implementing it? |
👍 |
@gvanrossum Haha, this is a bit more complicated than I thought. :O So,
Which would you prefer? |
I'd update typed_ast sooner than later. There's a precedent, we've already
got PEP 526 support. (http://mypy.readthedocs.io/en/latest/python36.html)
That was done by @ilevkivskyi.
|
@gvanrossum So, just to be clear, you mean option 1, right? |
Yes.
|
@kirbyfan64 Note that you could not just "copy" what is in Python 3.6b to If you will need some help while implementing f-strings in |
Python 3.6 has been released but mypy doesn't seem to support f-strings (even with mypy-lang-0.4.7.dev0 using the latest git commit as of now). |
We're waiting for python/typed_ast#22 to be reviewed and merged (presumably once @ddfisher is back from the holiday break), and pushed to PyPI as a new release. Then we need changes to mypy to use that. But you (== anyone reading this) can help by working on the mypy changes now. |
Thanks @gvanrossum! Could you give some indications on the changes required on mypy after the PR on typed_ast has been merged? (not to type check f-strings but just not to break on a code where f-strings are used) |
After python/typed_ast#22 merged, visit_JOINEDSTR should be implemented in mypy/fastparse.py so that it can handle f-strings. |
Adding some search keywords: string formatting, literal string interpolation, PEP 498. |
Already merged! |
Right now neither mypy's parser nor the fast parser can even parse them, let alone type-check them!
Since this is probably kind of complicated, I'd think it'd be easier to basically treat them like normal strings first and then move on to full type-checking.
The text was updated successfully, but these errors were encountered: