lawrence wang wrote:
> How do I refresh the interpreter environment without restarting it, if
> possible? For example, I'm using the interpreter to test a class I'm
> writing; importing and instantiating it reveals a typo; I go and fix
> the typo. Now, is there any way to reload the class afresh? Simply
> importing again doesn't seem to do it. Thanks in advance for your
> help.

Yes:

(echo "a=1" > a.py)
>>> import a
>>> a.a
1
(echo "a=2" > a.py)
>>> a = reload(a)
>>> a.a
2

Javier

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to