having both dynamic and static variables

John Ladasky ladasky at my-deja.com
Wed Mar 23 01:37:16 EDT 2011


On Mar 5, 9:44 pm, John Nagle <na... at animats.com> wrote:

>     All functions in Python can be replaced dynamically. While they're
> running. From another thread.  Really.

Indeed, and I find this feature VERY useful when coding.  Two places
I've used it are:

1) in GUI coding (say, when I have a panel of buttons, and each one
has its own associated function in my code -- but that function's name
is not part of the object definition itself) and

2) when profiling code, and I'm trying out various versions of a
function. For example, I'll write:

   for func in (func1, func2, func3):
       # do something with func()



More information about the Python-list mailing list