Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'forgive': 0.05; 'subject:Python': 0.06; 'falls': 0.09; 'friday,': 0.09; 'rewrite': 0.09; 'structure,': 0.09; 'subject:into': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; 'default:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'magic': 0.16; 'subject:variable': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'switch': 0.26; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'figure': 0.32; 'skip:_ 10': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'subject:?': 0.36; 'effort': 0.37; 'expressed': 0.37; 'handle': 0.38; 'pm,': 0.38; 'does': 0.39; 'chain': 0.60; 'subject:Can': 0.60; 'issues,': 0.61; 'first': 0.61; 'show': 0.63; 'mar': 0.68; 'batchelder': 0.84; 'conclude': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=u2Evv0WF67hOqGc3TBJm9p5E8hv90L+TkTqk62rYJ1w=; b=WZzvuvKOmBx/YtfkPjpZfF61Mj5iH4285bb/5fd/ThDkbgQU9AVXw7UIU0aNkmJQzh OmlXFCZ4Qnbadpi55B7tIOPdE+KYuTHyyf5xtHuLl7gVxcrmSyr72qiwoahoeDi5omsU XC2Ttg3cr2OB1oMeEXsKMcjUOBNIlhM0ikFtwXg25FxRHNQwaNuxJ+AN9WAWZVFSWmu4 eYcL+duiKfu6rioprqfwfW3EHYaJXPNfLuPoNK3kqQzE4npPuF8PeCqGAI5cYkyX5Prl r8kIXdz2xllmrnQkm9Q933Fm4m6mP98xmnSwDJisETHb5yWDL/TzZq8frinbUp4jjNX6 w/uA== MIME-Version: 1.0 X-Received: by 10.68.112.164 with SMTP id ir4mr6892978pbb.153.1393639305888; Fri, 28 Feb 2014 18:01:45 -0800 (PST) In-Reply-To: <4bd11eec-395a-4484-a991-9fabf12328e1@googlegroups.com> 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> <4bd11eec-395a-4484-a991-9fabf12328e1@googlegroups.com> Date: Sat, 1 Mar 2014 13:01:45 +1100 Subject: Re: Can global variable be passed into Python function? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393639309 news.xs4all.nl 2842 [2001:888:2000:d::a6]:33889 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67282 On Sat, Mar 1, 2014 at 12:08 PM, Mark H. Harris wrote: > On Friday, February 28, 2014 6:40:06 PM UTC-6, Ned Batchelder wrote: > >> >> 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. >> > > Forgive me. I would rewrite the structure, > > switch x: > case GT_1: > __atan__Gt_1__(x) > case LT_1: > __atan__Lt_1__(x) > case IS_1: > a = gpi/4 > case IS_n1: > a = -gpi/4 > default: > __atan__(x) > > or somesuch... way better... yes, there are some issues, but all workable with some effort Does your switch construct have to handle the magic of GT_1 meaning "> 1", or do you first figure out where it falls with an if/elif tree? ChrisA