Import config into global space?

Josiah Carlson jcarlson at uci.edu
Wed Mar 31 14:18:31 EST 2004


simo wrote:
> Josiah Carlson <jcarlson at uci.edu> wrote:
> 
> [global import from file]
> 
> 
>>from config import *
> 
> 
> Oh man! I can't believe it was that simple and I didn't think of it!
> 
> Actually, I've gone with the config.variable syntax for now anyway, it
> actually makes more sense as I don't have to name my variables like
> fontsize_config to differentiate them.


In general, "from module import *" is generally frowned upon, if only 
because it can clobber your module's namespace.  There are certainly 
exceptions, but namespaces are useful.

  - Josiah



More information about the Python-list mailing list