Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Namespace flooding with * imports
#2
This is a great explanation of the problems with using star imports, but I thought it worth mentioning that PEP 8 also discourages its use explicitly,

PEPĀ 8 Wrote:Wildcard imports (from <module> import *) should be avoided, as they make it unclear which names are present in the namespace, confusing both readers and many automated tools. There is one defensible use case for a wildcard import, which is to republish an internal interface as part of a public API (for example, overwriting a pure Python implementation of an interface with the definitions from an optional accelerator module and exactly which definitions will be overwritten isn't known in advance).


Messages In This Thread
Namespace flooding with * imports - by metulburr - Sep-01-2016, 08:14 PM
RE: Namespace flooding with * imports - by micseydel - Oct-03-2016, 06:43 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020