Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.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; 'else:': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'elif': 0.05; 'subject:Python': 0.06; 'strict': 0.07; 'coders': 0.09; 'elegant,': 0.09; 'essential.': 0.09; 'friday,': 0.09; 'function:': 0.09; 'lawrence': 0.09; 'question?': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:into': 0.09; 'python': 0.11; 'language.': 0.14; 'useful,': 0.14; 'block.': 0.16; 'confuse': 0.16; 'indent': 0.16; 'paradigm.': 0.16; 'readable': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'selected.': 0.16; 'statement.': 0.16; 'subject:variable': 0.16; 'third,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'trying': 0.19; "python's": 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'necessary.': 0.24; '---': 0.24; 'first,': 0.26; 'switch': 0.26; 'least': 0.26; 'skip:_ 20': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'besides': 0.30; 'statement': 0.30; 'code': 0.31; 'breaking': 0.31; 'second,': 0.31; 'skip:_ 10': 0.34; "can't": 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'subject:?': 0.36; 'clear': 0.37; 'expressed': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'that,': 0.38; 'does': 0.39; 'though,': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'chain': 0.60; 'subject:Can': 0.60; 'most': 0.60; 'free': 0.61; 'viruses': 0.61; 'simple': 0.61; "you're": 0.61; 'first': 0.61; 'show': 0.63; 'protection': 0.63; 'our': 0.64; 'more': 0.64; 'here': 0.66; 'between': 0.67; 'antivirus': 0.68; 'therefore': 0.72; 'batchelder': 0.84; 'conclude': 0.84; 'neck,': 0.84; 'pain': 0.84; 'trick,': 0.84; 'ugly,': 0.84; 'received:89': 0.85; 'absolutely': 0.87 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Can global variable be passed into Python function? Date: Sat, 01 Mar 2014 01:07:33 +0000 References: <27ac2248-0ca3-4ba6-9d25-eaad324bc5e9@googlegroups.com> <5f4f5a5f-327a-4616-8235-17ee9e74c488@googlegroups.com> <530fef58$0$11113$c3e8da3@news.astraweb.com> <871tynznpd.fsf@elektro.pacujo.net> <53104798$0$11113$c3e8da3@news.astraweb.com> <87ha7jy2qs.fsf@elektro.pacujo.net> <5310b031$0$29985$c3e8da3$5496439d@news.astraweb.com> <87iorzf4ro.fsf@elektro.pacujo.net> <877g8ff3hn.fsf@elektro.pacujo.net> <87wqgfdk6a.fsf@elektro.pacujo.net> <0b414429-74ee-45dd-9465-c87e98c362f2@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-89-240-161-236.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: X-Antivirus: avast! (VPS 140228-3, 28/02/2014), Outbound message X-Antivirus-Status: Clean 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: 59 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393636068 news.xs4all.nl 2891 [2001:888:2000:d::a6]:54704 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67270 On 01/03/2014 00:40, Ned Batchelder wrote: > On 2/28/14 6:36 PM, Mark H. Harris wrote: >> On Friday, February 28, 2014 3:03:25 PM UTC-6, Marko Rauhamaa wrote: >>> >>> Marko >> >> ... and between me and you, here is a snip from dmath.py from the >> atan(x) function: >> >> if (n**2 < D(1)): >> a = __atan__(n) >> elif (n == D(1)): >> a = gpi/4 >> elif (n == D(-1)): >> a = -(gpi/4) >> elif (n < D(-1)): >> a = __atan__Lt_neg1__(n) >> else: >> a = __atan__Gt_1__(n) >> >> This if--elif--else is not only ugly, its just not readable >> either, and besides that, its not elegant, nor is it humanly >> helpful... its does work though, and its absolutely necessary. ugh. >> >> First, its not immediately clear what it does. Well, there isn't >> just one atan(x) routine, there are at least four of them, depending >> on whether you're a purist, and they must be selected. >> >> Second, because of the strict intent ideology of python in the >> first place, I can't indent this code to make it more readable without >> breaking python's syntax. >> >> Third, this is a VERY simple if elif block. More complex ones are >> much worse... for human reading that is... >> >> I know its a pain in the neck, but python does need a switch >> statement. Is it a stubborn question? I don't really think that >> almost every modern computer language has a switch block because of >> some C paradigm. I think its because most coders find them useful, at >> least readable, and therefore essential. > > I don't understand: you show an if/elif chain that cannot be expressed > as a switch statement (because it uses < ), and then conclude that > Python needs a switch statement? That doesn't make any sense. > What a sneaky trick, trying to confuse people here with mere *FACTS* :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com