-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
raw f-strings #14288
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
Comments
related: yt-dlp/yt-dlp#9674 |
You can write a Python script to find f-strings and replace them with |
I would love to see this in MicroPython, but since I don't have interpreter or compiler building experience I have no idea why the docs say:
(I mean why it mention this to be the reason) I'd really appreciate it if any of the maintainers can shed some light on the reason why especially Raw f-strings would increase the build size of MicroPython. Andrew, you too are welcome to, I'm sure you'd be able to, as the freaking creator of the Zig programming language. but for now, building on the suggestion of dirkf, I suggest you do what I'll be doing: use food = "Hummus"
template = r""" I like {food}
It is yummy.""".format(**globals()) I initially tried using |
Well, my use case was running ytdlp inside micropython but that's not going to happen (see linked issue above), so I actually have no more stake in this issue. I solved my problem by building CPython with the zig build system and so I provide that runtime environment to ytdlp in my music player. I'll leave the issue open but I'm unsubscribing now. Cheers! |
Oops, pressed the wrong button |
Implementing raw f-strings was actually pretty easy, and did not increase code size. See #15218. |
Nice job |
Checks
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
I've searched for existing issues regarding this feature, and didn't find any.
Description
Here is a tracking issue for the implementation of raw f-strings.
Code Size
Parsers are pretty small if you don't overengineer them, and it could easily be configured at build-time. Also, Micropython has use cases outside of microcontrollers, such as my music player project.
Implementation
The text was updated successfully, but these errors were encountered: