[Tutor] How to import this program, and other questions
Alan Gauld
alan.gauld at btinternet.com
Sat Jan 20 19:01:16 CET 2007
"Dick Moores" <rdm at rcblue.com> wrote
> I've succeed with a script, clnumDivision.py, (see it
> at < http://www.rcblue.com/Python/clnumDivision_for-web.py>)
> but it is not one function, but a script with 3 functions plus a
> main(). So my first question is how can I use this as a function
> that I could, for example, import into the interactive shell
> ...Is the answer to put all 3 functions inside one big one?
Probably not, its more likely to be a small function that checks
its input parameters and calls one of the 3 worker functions.
Thats a more user friendly method too since it givers users of
the module the chance to use the internal functions in different
ways if they don't want the top level convenience function...
I assume your main is called from within an if name== main clause?
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list