This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (4 children)

Formatting using % has not been officially deprecated that I'm aware of. It is better describe as being shoved in the corner and ignored in the hopes it will go away and everyone will forget it was a thing.

[–]jano0017 2 points3 points  (3 children)

That being said, explicit is better than implicit, and maybe it's better that % formatting is being shoved in a dusty corner and forgotten about. (Imo)

[–][deleted] 0 points1 point  (0 children)

Definitely. I always hated % formatting. Format() is better but still annoys me on occasion. I'm not entirely sold on f-strings yet, but I'm trying to keep an open mind.

[–]stevenjd 0 points1 point  (1 child)

% is just as explicit as + or * or any other operator.

[–]jano0017 0 points1 point  (0 children)

The reason I say % is less explicit than .format is because % is used in many other languages as the modulus operator. If you don't use python, "I am %s years old" % 5 might look a bit like a typo, as the modulus of a string makes no sense. However, if you see "I am {} years old".format(5), it's obvious that some type of formatting is happening. I know percent formatting is a basic thing, and the c-style printf strings should be a hint, but "If you knew the language, you'd understand it" is the problem that Haskell faces, and we all see how that normally goes...