from package import * without overwriting similarly named functions?

Lie Ryan lie.1296 at gmail.com
Sat Oct 25 04:09:17 EDT 2008


On Fri, 24 Oct 2008 11:06:54 -0700, Reckoner wrote:

> I have multiple packages that have many of the same function names. Is
> it possible to do
> 
> from package1 import *
> from package2 import *
> 
> without overwriting similarly named objects from package1 with material
> in package2? How about a way to do this that at least gives a warning?

That (overwritten names) is exactly the reason why wildcard import should 
be avoided.

Use:
from package1 import blah
import package2

But avoid:
from package3 import *





More information about the Python-list mailing list