Python Madlibs.py code and error message

Stephen Hansen me at ixokai.io
Thu Apr 28 03:08:50 EDT 2016


On Wed, Apr 27, 2016, at 11:55 PM, Ben Finney wrote:
> Stephen Hansen <me at 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?

You can show using non-positional values using the format the user is
using -- "%(name)s" formatting. You even reference a link to the Python
3 docs, even though the OP is running code which isn't 3.x compatible.
Confusion.

Wishing Python2 away isn't helpful. 

-- 
Stephen Hansen
  m e @ i x o k a i  . i o



More information about the Python-list mailing list