Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: Python Madlibs.py code and error message Date: Thu, 28 Apr 2016 17:17:47 +1000 Lines: 31 Message-ID: References: <3cff626c-28a2-499c-9877-de2df4d459d0@googlegroups.com> <6c0d96c5-c7f5-4659-a2e9-20f8d202d701@googlegroups.com> <1461820617.3238425.591942249.1484DAC3@webmail.messagingengine.com> <85fuu6jo1o.fsf@benfinney.id.au> <1461826246.3257796.591992793.54C5CC58@webmail.messagingengine.com> <85bn4ujk7p.fsf@benfinney.id.au> <1461827330.3261212.591998673.4D215991@webmail.messagingengine.com> <857ffijj6s.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de q5L6rPm6r5tzCU2tf+52mAx4phr5ciOyLmxYCpFBQumQ== Cancel-Lock: sha1:chgl0zCgSfNRUZTa764hctRr8sg= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'formatting': 0.07; 'subject:code': 0.07; 'confuse': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'subject:error': 0.11; 'wed,': 0.15; '*any*': 0.16; 'formatting,': 0.16; 'formatting.': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'those,': 0.16; 'wrote:': 0.16; 'pointed': 0.18; 'skip:% 10': 0.22; 'stephen': 0.22; 'examples': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'parameters': 0.27; 'fine': 0.28; 'helpful.': 0.29; 'that.': 0.30; 'primary': 0.31; 'point': 0.33; 'point,': 0.33; 'raising': 0.33; "i'll": 0.33; 'false': 0.35; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'why': 0.39; 'format': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'more': 0.63; 'to,': 0.63; 'series': 0.65; 'judge': 0.66; 'risk': 0.68; 'skip:\xe2 10': 0.70; '_o__)': 0.84; 'premises': 0.84; 'received:125': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <857ffijj6s.fsf@benfinney.id.au> X-Mailman-Original-References: <3cff626c-28a2-499c-9877-de2df4d459d0@googlegroups.com> <6c0d96c5-c7f5-4659-a2e9-20f8d202d701@googlegroups.com> <1461820617.3238425.591942249.1484DAC3@webmail.messagingengine.com> <85fuu6jo1o.fsf@benfinney.id.au> <1461826246.3257796.591992793.54C5CC58@webmail.messagingengine.com> <85bn4ujk7p.fsf@benfinney.id.au> <1461827330.3261212.591998673.4D215991@webmail.messagingengine.com> Xref: csiph.com comp.lang.python:107767 Stephen Hansen 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