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

5

u/LpSamuelm Nov 24 '16

Why would I ever use .format(...)? It's worse than %s and slower. There are now 2 methods in my book and 1 that I can use because I write Python 2/3 code.

That's interesting. I never use % formatting. It's a fairly gross overload of the modulus operator, and has weird syntax. str.format is explicit and clear, and if it's slower than % it's negligible.

1

u/billsil Nov 24 '16

str.format is explicit and clear

It's very verbose and requires me to create a dictionary that I don't have in order to write the string part in a way that looks sane. I really want to use f-strings, but Python 2 doesn't support it...

2

u/troyunrau ... Nov 24 '16

f-strings bother me. Of all the complaints about the complaints in the article, the multiple string formatting complaint is legit. Python 2 had one obvious way to do string formatting. Python 3.6 has three.

1

u/LpSamuelm Nov 25 '16

I really am not bothered at all by that. Just use the newest one (that supports your target Python versions), and you're all done. Learning to read and recognize the other two is trivial, too.

→ More replies (5)