Can global variable be passed into Python function?
Chris Angelico
rosuav at gmail.com
Fri Feb 28 21:01:45 EST 2014
On Sat, Mar 1, 2014 at 12:08 PM, Mark H. Harris <harrismh777 at gmail.com> 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
More information about the Python-list
mailing list