Can global variable be passed into Python function?

Ned Batchelder ned at nedbatchelder.com
Sat Mar 1 03:15:38 CET 2014


On 2/28/14 8: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
>

Mark, if you are going to advocate for a feature, find a good use case, 
this one is absurd.  Where did the constants GT_1 etc, come from?

-- 
Ned Batchelder, http://nedbatchelder.com




More information about the Python-list mailing list