NameError in cross imports of modules

Jay O'Connor joconnor at cybermesa.com
Sun Feb 4 08:39:21 CET 2001


Thomas Wouters wrote:

> and as far as I'm concerned there are only two viable uses: the way
> os.py uses it (import any and all symbols from a platform-dependant C
> module) and the way Mailman uses it (import all symbols from a template
> config file into the user-editable config file, so it only needs to contain
> overriding values.) I still owe Fred a "From module import * considered
> harmful" tutorial-section ;-P If prefixing all module variables with the
> module name is too painful because the module name is too long or unclear,
> consider using 'import my_long_module as _a' or some such.


I've followed the convention (maybe I made it up for myself :)  That if
I'm importing classes, I use "from package import *" such as "from gtk
import *", but if I'm importing a module of functions, I just use
"import package name" such as "import string" and use the module name
prefix for all function calles.

Don't know if it's good or not...


Take care,
-- 
Jay O'Connor
joconnor at cybermesa.com
http://www.cybermesa.com/~joconnor

"God himself plays the bass strings first when He tunes the soul"



More information about the Python-list mailing list