is there an equivalent of javascript's this["myMethod"] for the currently running script?

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Wed Jul 6 05:58:39 CEST 2005


markturansky at gmail.com enlightened us with:
> var m = this["MethodName"];
> m();  //this invokes a method in javascript
>
> How do I do the same in python?

getattr. Read the documentation, it's all in there.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa



More information about the Python-list mailing list