Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3094
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: Testing changes to Python code on the fly: reload() + alternatives? |
| Date | 2011-04-12 18:49 -0400 |
| References | <31f668e3-639f-4d4d-b406-0e3342d115a8@glegroupsg2000goo.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.288.1302648583.9059.python-list@python.org> (permalink) |
On 4/12/2011 3:26 PM, Keith wrote: > 1) Is it possible to reload a class using the reload() method? Yes, but instances of the old version will remain instances of the old version, which will not go away until all its instances and other references go away. So reload is deceptive, which is why it was semi-hidden away in 3.x in the inspect module. >>> class C: pass >>> c = C() >>> class C: pass # simulate reload >>> c2 = C() >>> id(c.__class__) 16018776 >>> id(c2.__class__) 16039320 > 2) More generally though, what is the best way to go about testing changes to code Restart from the beginning. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar
Testing changes to Python code on the fly: reload() + alternatives? Keith <keith.hughitt@gmail.com> - 2011-04-12 12:26 -0700 Re: Testing changes to Python code on the fly: reload() + alternatives? Terry Reedy <tjreedy@udel.edu> - 2011-04-12 18:49 -0400
csiph-web