Automatic import ?

Jean-Michel Pichavant jeanmichel at
Sat Mar 27 13:42:07 CET 2010

C. B. wrote:
> [snip]
> It takes time to write the relative importations, that's ok, but I
> think it could be more pleasant for the end-user to not have to write
> a huge list of "from mymodule import xxx" if it is possible to take
> advantage of automatic importations.
> Cheers,

In that particular case, replace automatic by implicit, and you got the 
reason why it is not a good idea.
Maybe in your case the C habits clashes to the python habits.

Talking about python, if the user needs to know about BBB, then it has 
to import it, perdiod. If the user needs to know about many objects, 
then it has to import them all, explicitly.
However it looks like all your objects belong to the same module, 
quoting MRAB:

Couldn't you just have:

    import mymodule as m

and then use:


You don't like prefixing your object with the namespace they belong to ? 
Well, you should :o)


PS : I would'n have renamed the module, but that falls into personal 

More information about the Python-list mailing list