where to import

andrea crotti andrea.crotti.0 at gmail.com
Thu Feb 17 11:44:15 EST 2011

Suppose I have a function which uses a few external libraries,
and this function is only called once every 10 executions.

Does it make sense to import these libraries for the whole module?

import sys

def fun():
    import x, y, z

Something like this is acceptable/good practice in the scenario I was
talking about?
Does it make any difference for performances too?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110217/27a2d0fc/attachment.html>

More information about the Python-list mailing list