load changes of subclasses
Gerrit Holl
gerrit at nl.linux.org
Tue Sep 23 11:33:23 EDT 2003
Tom wrote:
> Date: Tue, 23 Sep 2003 16:56:55 +0200
>
> Hi,
>
> I have a main program that uses a lot of definitions in different classes.
> They are included like this:
> from subclass1 import *
> from subclass2 import *
Note that 'subclass1' and 'subclass2' are not classes, but modules. A
class is created with the 'class' statement:
class MyClass:
def method(self):
return "Hi there!"
A module is a file in the library.
> My problem is: whenever I make changes in one of the classes I have to
> close and reopen the main program for the changes to take effect. This
> is kind of annoying, because I always want to test if my changes are
> correct and that's why I have to run the main program. Is there some
> kind of a shortcut where I don't have to close and reopen the main program?
You can use the reload() function for that:
>>> print reload.__doc__
reload(module) -> module
Reload the module. The module must have been successfully imported before.
> I hope this question is not too stupid, but I am still quite new to Python.
Stupid questions do not exist (hm, my first post here makes me think otherwise),
stupid answers do, so:
I hope this answer is not too stupid, but I am not a Computer Scientist.
yours,
Gerrit.
--
241. If any one impresses an ox for forced labor, he shall pay
one-third of a mina in money.
-- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
http://www.sp.nl/
More information about the Python-list
mailing list