Python Madlibs.py code and error message

Ben Finney ben+python at benfinney.id.au
Thu Apr 28 03:17:47 EDT 2016


Stephen Hansen <me at ixokai.io> writes:

> On Wed, Apr 27, 2016, at 11:55 PM, Ben Finney wrote:
> > Everything I described above works fine in Python 2.
>
> This response is completely unhelpful.

I'll let the OP be the judge of that.

> 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?

I don't know why you keep raising Python 2 as though it matters. As I
pointed out, everything I discussed works fine on Python 2 without any
change.

More to the point, *even if* they continue using ‘%’ formatting, the
primary point was to use named parameters.

That is relevant to Python 3 and Python 2; it is relevant to ‘%’
formatting and ‘str.format’ formatting. None of those need to change.

So I encourage the OP to try using named format parameters in *any* of
those, and then judge whether it is helpful.

-- 
 \              “Begin with false premises and you risk reaching false |
  `\   conclusions. Begin with falsified premises and you forfeit your |
_o__)                          authority.” —Kathryn Schulz, 2015-10-19 |
Ben Finney




More information about the Python-list mailing list