[Python-ideas] Allow multiple imports from a package while preserving its namespace

Chris Angelico rosuav at gmail.com
Thu Apr 26 11:24:23 EDT 2018


On Thu, Apr 26, 2018 at 11:53 PM, Julian DeMille via Python-ideas
<python-ideas at python.org> wrote:
> That's the kind of thing I'm looking for. I've dealt with some library
> authors who were highly against importing the root allowing me to access
> submodules with hierarchy.

With a package, having automatic imports forces those submodules to be
loaded eagerly (as soon as you import the package, you load up those
modules). Lazily-loaded submodules can improve performance if you
don't always need them.

+0 for an easier way to import multiple submodules at once. It's not
something I've personally had a need for, but it's a sane and logical
thing to do.

ChrisA


More information about the Python-ideas mailing list