On 01/06/2012 03:04 AM, Andres Soto wrote:
Please, see my comments between your lines. Thank you very much for your explanation! * * *From:* Lie Ryan <[email protected]> *To:* [email protected] *Sent:* Thursday, January 5, 2012 2:30 AM *Subject:* Re: a little helpOn 01/05/2012 11:29 AM, Andres Soto wrote: > my mistake is because I have no problem to do that using Prolog which > use an interpreter as Python. I thought that the variables in the main > global memory space (associated with the command line environment) were > kept, although the code that use it could change. > As you explain me, Python behave like a compiled language: any time I > make a change in the code, I have to "compile" it again, and re-run (and > re-load the data). There is nothing to do. it is usually trivial to redefine state-free functions, you just need to copy and paste the new code into the shell. &&&yes, I am already using that, but I thought that maybe there were a more elegant way. In Prolog, you just have to reload the code and nothing happens with the global variables
Alternative to copy pasting is to reload the module; but that comes with the caution that the old function/class definition may still be lying around in the global namespace if you imported them into your global namespace, so you had to either restrict yourself to using class/function using the module namespace or you had to remember to reimport them into your global namespace. You also need to be careful if you passes a module function as callbacks, as the callback will not be automatically replaced with the new definition.
-- http://mail.python.org/mailman/listinfo/python-list
