Problems with Python IDLE

Mike Driscoll kyosohma at gmail.com
Tue May 27 10:05:32 EDT 2008


On May 27, 3:54 am, Giraffe <kerstin.vilters... at semcon.com> wrote:
> I have the followong class in a file:
> --------------------------------------------
> class someClass:
>    def __init__ (self):
>       self.someVar = 10
>
>    def getSomeVar (self):
>       return self.someVar
> --------------------------------------------
>
> In another file a do the following:
> --------------------------------------------
> tmp = someClass ()
> tmp.getSomeVar ()
> --------------------------------------------
>
> I run the second file in the IDLE environment and everything seems to
> be working fine until I start to modify in the first file:
> --------------------------------------------
> class someClass:
>    def __init__ (self):
>       self.someVar = 10
>
>    def getSomeVar (self):
>       print "Modified class!"
>       return self.someVar
> -------------------------------------------
>
> When I now try to run the second file in the IDLE environment again, I
> DO NOT get the newly added printout. I have saved and compiled (run)
> both files but there is still no change. What have I missed?


You might also look into the reload(module) function, documented here:

http://docs.python.org/lib/built-in-funcs.html

It's made for that sort of thing.

Mike



More information about the Python-list mailing list