Am Montag, 14. Februar 2011, um 12:50:58 schrieb A.T.Hofkamp:
> In python it is recommended (for as long as I can remember) to import
> modules only at the top of the file. It makes it easier to find the
> imports, and it limits import overhead to just during start up.
> 
> There are a few exceptions to this rule, the most important being import of
> a module that you almost never need which takes a lot of time to start.
> I have yet to encounter that case though.

NumPy / SciPy is a good case; they've tackled the problem of looooong import 
times by explicitly making a lot of imports local.

Anyhow, you'll quickly "encounter that case" (as I and a lot of other people 
did) if you are interested in a single function from scipy that's only needed 
for a single optional feature of your program.

HTH
  Hans
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to