On Thursday 28 April 2016 17:08, Stephen Hansen wrote:

> On Wed, Apr 27, 2016, at 11:55 PM, Ben Finney wrote:
>> Stephen Hansen <m...@ixokai.io> writes:
>> 
>> > On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote:
>> > > Better: when you have many semantically-different values, use named
>> > > (not positional) parameters in the format string. […]
>> > > 
>> > >     <URL:https://docs.python.org/3/library/string.html#formatstrings>
>> >
>> > Except the poster is not using Python 3, so all of this is for naught.
>> 
>> Everything I described above works fine in Python 2. Any still-supported
>> version has ‘str.format’.
> 
> This response is completely unhelpful. The OP is using Python 2, and
> using %-formatting, and so you give a series of examples of using
> str.format, to, what? Confuse matters?

How about we assume good faith and give Ben the benefit of the doubt that he 
simply made a minor and trivial misjudgement rather than accusing him of 
intentionally trying to confuse matters?

You are correct that the OP can use % formatting with named arguments. Ben 
is correct that the OP can also change his code to use str.format. Some 
people hate %-formatting and cannot wait to migrate to {}-formatting, and 
some people don't.

(For the record, Internet rumours that %-formatting is deprecated are simply 
not correct.)



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to