Import without executing module

Taskinoor Hasan taskinoor.hasan at csebuet.org
Mon Feb 2 08:43:56 CET 2009


Can anyone explain what is the necessity of executing whole script when
importing. Isn't it enough to just put the module name in the namespace and
execute when some function is called?

On Mon, Feb 2, 2009 at 1:36 PM, Stephen Hansen <apt.shansen at gmail.com>wrote:

> > Maybe he can wrap the things he dont need inside
> > if __name__ == '__main__':
> > check.
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
>
> Yeah but he said he doesn't want to modify the file itself-- if he can
> modify the file this can all go away readily, yes.
>
> --S
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090202/f737c7bb/attachment.html>


More information about the Python-list mailing list