r/Python • • Nov 24 '16

The Case for Python 3

https://eev.ee/blog/2016/11/23/a-rebuttal-for-python-3/
575 Upvotes

349 comments sorted by

View all comments

Show parent comments

1

u/earthboundkid Nov 24 '16

Percent formatting is fundamentally unsafe because if the argument is unexpectedly a tuple, you can cause a failure. I.e. "Value:\t%s" % val will explode if val is a tuple.

That said, I think there are too many formatting choices in Python. It's not very "one obvious way to do it."

2

u/Joshx5 Nov 24 '16

Right, tuples require a clunkier syntax to be safe, and that's obviously problematic. I talked about this and the non-Pythonic nature of string formatting in the blog post above.

As ridiculous as it sounds to introduce a new standard (incoming XKCD), I really hope f-strings can replace the other styles altogether for new code. Probably a bit too hopeful, though