[Tutor] How to import this program, and other questions
Dick Moores
rdm at rcblue.com
Sat Jan 20 19:57:10 CET 2007
At 10:01 AM 1/20/2007, Alan Gauld wrote:
>"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?
Yes. I just realized that I quoted the link wrong. Try
<http://www.rcblue.com/Python/clnumDivision_for-web.py>
The only user I have in mind is me. And I want to use all 3 functions
together. Now that you've seen the program, could you explain what
you meant by "a small function that checks its input parameters and
calls one of the 3 worker functions."?
Thanks,
Dick Moores
>HTH,
>
>--
>Alan Gauld
>Author of the Learn to Program web site
>http://www.freenetpages.co.uk/hp/alan.gauld
>
>_______________________________________________
>Tutor maillist - Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list