[Tutor] Trying to avoid using eval..
__peter__ at web.de
Sat Feb 23 09:45:39 CET 2013
Rohit Mediratta wrote:
> I want to reload my Module after I fix bugs and want to instantiate an
> object of a class contained in this module.
Just a warning about reload(), as your question was already answered:
Reloading modules may seem convenient at first, but can lead to strange
errors as existing objects are not updated:
>>> import module
>>> obj = module.SomeClass()
<module 'module' from 'module.pyc'>
>>> isinstance(obj, module.SomeClass)
Personally I avoid reload() (and importing the main script which leads to
More information about the Tutor