Can global variable be passed into Python function?

Marko Rauhamaa marko at pacujo.net
Sun Mar 2 10:52:07 EST 2014


Roy Smith <roy at panix.com>:

> In article <87fvn08vux.fsf at elektro.pacujo.net>,
>  Marko Rauhamaa <marko at pacujo.net> wrote:
>> 3. TRY-EXCEPT (3500% slower than DICT DISPATCH TABLE)
>
> I'm glad to hear that. I hope nobody took me seriously when I
> suggested this.

I actually have employed the idea before in a related but slightly
different use case.

Anyway, it's extremely close to the switch statement's use case and
should give some guidance if a proper switch statement is ever worked
into the language. What's killing the performance is the backtrace
generation and longjmp trickery. If an analogous syntax could be (A)
separated from BaseException and (B) compiled into a dict, we could have
a winner.


Marko



More information about the Python-list mailing list