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

I can see why you might want the second change (discarding superfluous information), but string formatting looks better to me in the first case: it's more terse, and embeds type information in the format string using a well known and understood convention.

Why do you prefer the explicit method call over an operator?




It's arguable, but operator overloading should only be used (if at all) when there is conceptual symmetry between the standard and overloaded usage (eg, adding two datetime objects with '+').

I can't think of any way that taking the modulo of two strings logically results in interpolation. If anything, it should do something like return the original string with all instances of the argument removed. It's just simpler to not support it at all and use the standard .format() method.

There's also the fact that it's deprecated, of course. :)


% format is deprecated in the python spec.




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

Search: