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

I don’t think I’ve ever used % formatting in Python - what makes it safer than `format`?


`str.format` allows the format string to navigate through indexes, entries, and attributes. If the result of the formatting is echoed back and any non-trivial object it passed in, it allows for all sorts of introspection.

printf-style... does not support any of that. It can only format the objects passed in.




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

Search: