[Python-ideas] Allow multiple imports from a package while preserving its namespace
julian.demille at demilletech.net
Tue May 22 12:46:40 EDT 2018
The fact of explicit dependency noting is why I suggested something that
explicitly defines multiple imports in one line
On Sat, Apr 28, 2018 at 9:28 PM Greg Ewing <greg.ewing at canterbury.ac.nz>
> Nick Coghlan wrote:
> > I find the imports at the top of the file to be a nice
> > catalog of external dependencies.
> Not only is it useful for human readers, it's also useful
> for packaging tools such as py2exe that need to know which
> modules are being used.
> I experimented once with auto-importing in PyGUI, but in
> the end I dropped it, partly because of this consideration.
> There were other problems with it as well. I don't recall
> all the details, but I think one issue is that any errors
> resulting from an import triggered by an attribute access
> get masked and turned into an AttributeError, making them
> very confusing to diagnose.
> Also, importing requires acquisition of the import lock,
> which could cause problems in a multithreaded environment
> if it happens at unpredictable times.
> For these reasons I'm inclined to regard auto-importing
> as an anti-pattern -- it seems like it should be a good
> idea, but it leads to more problems than it solves.
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
CEO, demilleTech, LLC
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager.
This message contains confidential information and is intended only for the
individual named. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and
delete this e-mail from your system. If you are not the intended recipient
you are notified that disclosing, copying, distributing or taking any
action in reliance on the contents of this information is strictly
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas