[Python-ideas] Enhance reload
clarkksv at yahoo.com
Sun Sep 30 15:22:36 CEST 2007
Greg Ewin wrote:
> What you suggest sounds like it ought to be possible,
> at first sight, since Python function objects are already
> containers with a reference to another object that
> holds the function's code.
> The problem will be figuring out *when* you're redefining
> a function, because the process of loading a module is a
> very dynamic one in Python. Defining functions and classes
> is done by executing code, not by statically analysing
> declarations as a C compiler does.
My implementation is definitely a high level scetch.
The kind of issues you are bringing up is exactly the kind of thing I'm looking for. If there are more, lets see them.
Would temporarily marking the module with "replace" work? I would think that when the function is defined, it has access to the module (because it is adding to its dictionary) and it could check for the "replace" attribute. I'm assuming a certain sequence of execution here since the "replace" attribute would have to removed after the function/method code was executed/loaded. Anyone who knows that this isn't the case, please shoot this down.
Another post I read proposed a Reclass feature that only worked for classes. Given the macro language scenario, you definitely need functions too.
Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV.
More information about the Python-ideas