Reputation: 4317
How do you import classes and methods from another module without retaining the former module namespace?
I am current refactoring some legacy code and am frequently doing imports similar to these.
from legacy_module import ClassA as ClassA
from legacy_module import ClassB as ClassB
from legacy_module import ClassC as ClassC
from legacy_module import methodA as methodA
from legacy_module import methodB as methodB
This is done so that the classes can be referenced as ClassA rather than legacy_module.ClassA.
In python, how do you import all of the classes and methods above in a single statement?
from legacy_module import * as *
Upvotes: 34
Views: 49513