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

This is a massive improvement. I currently use .format(), sometimes with locals(), but f-strings would improve this massively.

Now if only they didn't require Python 3, so I could use them on the production systems I'm working on...



I switch back and forth between format and %, and never use locals in the format. It's annoying, every time a string is written, to try to decide which way is better for this instance. That said, is there a way to do ('%.3f' % x) with this?


f'{x:.3f}'




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: