String concatenation

Steven D'Aprano steve at pearwood.info
Mon May 9 22:32:22 EDT 2016


On Tue, 10 May 2016 07:21 am, Thomas 'PointedEars' Lahn wrote:

> Chris Angelico wrote:
> 
>> On Mon, May 9, 2016 at 10:44 AM, Thomas 'PointedEars' Lahn
>> <PointedEars at web.de> wrote:
>>> With the “%” string operator (deprecated), str.format(), and
>>> str.Template, you can use other values in string values even without
>>> concatenation.
>> 
>> Not deprecated. Don't spread FUD.
> 
> If only you cared to read what I referred to:
>
> ,-<https://docs.python.org/3/library/stdtypes.html#old-string-formatting>

That is excellent advice Thomas!

If only you had followed it yourself, instead of blindly and mechanically
copying and pasting. If you had bothered to actually read it, you would
have seen that *nowhere* does it say that the % string operator is
deprecated.

Deprecation has a specific meaning involving a formal process of removing a
feature from the language. It doesn't merely mean "this old feature has
quirks and we think you should use this new feature instead". Some of the
core developers like `format` better and think that people should use it in
preference to the % string operator. That much is true. But that is far
from being deprecated.


> Note the key words: “old”, “quirks”, “errors”.

Irrelevant to the question of deprecation.

Floats are old (they go back to the first release of Python), they have many
quirks (x + y - x is not necessarily equal to y), and people make many
errors with floats. Does this mean they are deprecated? Of course not.


-- 
Steven




More information about the Python-list mailing list