3 ms·
Wait -- wasn't % formatting deprecated long ago in favour of the .format() method?
by kzrdude 13y ago
Wait -- wasn't % formatting deprecated long ago in favour of the .format() method?
- deckiedan 13y agoYes. And then they bought it back again. Py3.3, I think...
- scrollaway 13y agoIf "you think", please look it up instead of blindly confirming. %s was never deprecated. str.format is said to be preferred, and maybe one day it will completely replace %s. Heaven knows if that'll even happen in 4.0, it's a bigger switch than 3.x's print() and unicode changes combined. http://docs.python.org/2/library/stdtypes.html#str.format http://docs.python.org/2/library/stdtypes.html#str.format
- bru 13y agoYou're right and that surprises me as well. > As noted above, ``%s`` is being included solely to help ease migration from, and/or have a single code base with, Python 2.
- Thrymr 13y agoNo, % formatting was never deprecated. The Python 3.0 release notes [1] said "The plan is to eventually make this [the .format() method] the only API for string formatting, and to start deprecating the % operator in Python 3.1" but it never happened. [1] http://docs.python.org/3.0/whatsnew/3.0.html http://docs.python.org/3.0/whatsnew/3.0.html
- njharman 13y agoSome people thought % formatting sucked and made .format(). It was then discovered that some not insignificant number of people found .format() a complex abomination and so deprecation plans were nixed.
- beaumartinez 13y agoInteresting—do you have any links to back this up?
- njharman 13y agoNope, it is my opinion.