Ignore error with non-zero exit status

Chris Angelico rosuav at gmail.com
Mon Dec 21 19:25:40 EST 2015


On Tue, Dec 22, 2015 at 11:17 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Dec 21, 2015 4:55 PM, "Terry Reedy" <tjreedy at udel.edu> wrote:
>>
>> Nothing has changed since except for
>> https://www.python.org/dev/peps/pep-0498/
>> already added to 3.6.
>
> https://xkcd.com/927/

The 927ness of it was discussed at length prior to implementation. PEP
498 isn't really another competing string format operation; it's more
like an alternative expression format. It's more in competition with
this:

msg = "The sum of " + str(x) + " and " + str(y) + " is " + str(x+y) + "."

which puts the interpolated expressions at the "correct place" in the
string - but at the cost of being verbose, messy, and error-prone.
Compare:

msg = f"The sum of {x} and {y} is {x+y}."

(Yes, there's a slight semantic difference; the latter uses format()
rather than str(). But otherwise, it's compiled to the "".join(...)
equivalent of the repeated concatenation example.)

ChrisA



More information about the Python-list mailing list