Where should 'import' statement be put?

gyromagnetic gyromagnetic at excite.com
Tue Apr 16 11:49:06 EDT 2002


Hi,
I was wondering what the 'best practice' is for locating 'import'
statements. If I have a module comprising several classes, each of
which has several functions, should the import statements be grouped
- at the top of the module?
- at the top of the classes in which they are relevant? 
- at the top of the functions in which they are relevant?

I believe imports are done only once regardless of the number of times
the statement appears, but are there any other considerations here? I
realize there may be scoping issues as well.

Thanks for the advice.

-gyro



More information about the Python-list mailing list