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

Thanks for the that bit of info! I was surprised by the speed difference. I have always assumed that most variations of basic string formatting would compile to the same bytecode.

I usually prefer classic %-formatting for readability when the arguments are longer and f-strings when the arguments are shorter. Knowing there is a material performance difference at scale, might shift the balance in favour of f-strings for some situations.





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

Search: