Importing some functions from a py file
Anthony Liu
antonyliu2002 at yahoo.com
Wed Apr 20 00:11:46 EDT 2005
O, sorry, I did have
main()
at the very end of code1.py.
Sorry for this confusion.
--- John Machin <sjmachin at lexicon.net> wrote:
> On Tue, 19 Apr 2005 20:17:06 -0700 (PDT), Anthony
> Liu
> <antonyliu2002 at yahoo.com> wrote:
>
> >The choice is (b):
> >
> >(b) you do have "def main()" as per my example, but
> >you have an unguarded "main()" at the top level
> >
> >Below is exactly what I have:
> >
> >def func1():
> > do_sth_1()
> >
> >def func2():
> > do_sth_2()
> >
> >def main():
> > do sth_m()
> >#end of code1.py
>
>
> If that's what you have, then main() won't be
> executed *EVER*, neither
> when code1 is imported, nor when it is run as a
> script.
>
> >
> >So, you suggest that if I add to the end of
> code1.py
> >module the following,
> >
> >if __name__ == "__main__":
> > main()
> >
> >I should be OK, right?
> >
> >
>
> Maybe, nobody can tell WTF is going on from your
> descriptions :-(
> --
> http://mail.python.org/mailman/listinfo/python-list
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
More information about the Python-list
mailing list