Hacker News new | past | comments | ask | show | jobs | submit login

Also, why abandon printf-style? All languages tend to converge to printf over time, it's simply the most tried and tested model out there!




Format string is very inconvenient approach because you need to duplicate type information.

>>> '%i' % 's' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: %i format: a number is required, not str >>> '{}'.format('s') 's' >>> '{}'.format(10) '10'


javascript, python, rust, etc. don't use printf style, but instead use the {} style.


Yeah, well Rust isn't exactly a success story in that regard if you ask me. A couple of weeks ago I tried to figure out how to format a float properly in Rust, and the way they made it work is a lot worse than straight up printf-style if you ask me.




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

Search: