Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'lawrence': 0.09; 'prefix': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'assume': 0.14; 'language.': 0.14; 'brackets': 0.16; 'brackets.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'stem': 0.16; 'language': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'aug': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'rid': 0.24; 'gets': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'tried': 0.27; "doesn't": 0.30; 'work.': 0.31; '+0100,': 0.31; 'test': 0.35; 'done': 0.36; "didn't": 0.36; 'changing': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'deleting': 0.60; 'break': 0.61; 'our': 0.64; 'charset:windows-1252': 0.65; 'subject:This': 0.74; 'subject:interesting': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: This could be an interesting error Date: Mon, 01 Sep 2014 00:21:14 +0100 References: <4u870addqootc65rs6996s88fg3gihqc09@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-78-146-3-67.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: <4u870addqootc65rs6996s88fg3gihqc09@4ax.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1409527293 news.xs4all.nl 2865 [2001:888:2000:d::a6]:42616 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77370 On 31/08/2014 23:42, Seymore4Head wrote: > On Sun, 31 Aug 2014 22:38:12 +0100, Mark Lawrence > Unnecessary brackets? > I tried deleting the brackets and that doesn't seem to work. I tried > changing the brackets to parenthesizes and that didn't work. Although > I would prefer brackets to parenthesizes as you don't need shift to > type them. > >>> pigword = stem + prefix + "ay" >>> print ("Stem ",stem) >>> print ("Prefix",prefix) >>> print (pigword) >>> break >>> return (pigword) These ^ ^ >> >> This is Python so please get rid of those unnecessary brackets. Having >> done that assume that you have an empty test so your loop never gets >> entered, the local pigword never gets assigned before the return hence >> your UnboundLocalError. >> -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence