Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18560 > unrolled thread
| Started by | Lie Ryan <lie.1296@gmail.com> |
|---|---|
| First post | 2012-01-06 06:53 +1100 |
| Last post | 2012-01-06 06:53 +1100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: a little help Lie Ryan <lie.1296@gmail.com> - 2012-01-06 06:53 +1100
| From | Lie Ryan <lie.1296@gmail.com> |
|---|---|
| Date | 2012-01-06 06:53 +1100 |
| Subject | Re: a little help |
| Message-ID | <mailman.4459.1325793228.27778.python-list@python.org> |
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 <lie.1296@gmail.com> > *To:* python-list@python.org > *Sent:* Thursday, January 5, 2012 2:30 AM > *Subject:* Re: a little help > > On 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.
Back to top | Article view | comp.lang.python
csiph-web