[Tutor] Help with functions

Kirby Urner urnerk@qwest.net
Tue, 18 Jun 2002 10:09:39 -0400


> That is my source code so far. I'm following the tutorial at http://www.honors.montana.edu/~jjc/easytut/easytut/node9.html
> and I had a question. Every time I try to get a function to ask for the input of the sides, lenght, width, whatever, it doesn't work. Something funny I found out is that it might work, but then when I quit python and open it again, it doesn't work, saying that ''length' is not defined'. Any thoughts??
>  

If it works when you quit and go back into Python, it might be a reload issue.
If you're in the interpreter and make a change to a .py file in a text editor,
and save it, the interpreter will still operate with the old compiled .pyc
unless you force a recompile using reload(name_of_module).  

It's a little trickier if you don't import the module, but members of the 
module.  A workaround is to import the module as well, for the purpose of 
forcing a reload, and then reissuing the 'from xxx import a,b,c' command 
as before.  This can be done as a function itself.

Kirby