Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

TIL. str.format and % parse the format string at runtime, so it's expected that they're slower. But I thought the f-string desugars to something similar to the last one. Turns out it's not, it compiles to specialized opcodes and avoids function calls:

https://bugs.python.org/issue25483

https://bugs.python.org/issue27078



Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: