Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Python import precedence: packages or modules?

Current License: CC BY-SA 3.0

6 events
when toggle format what by license comment
Jan 10, 2017 at 23:05 history edited kanaka CC BY-SA 3.0
Link to python source showing that packages come before modules
Jan 10, 2017 at 22:58 comment added qff Found it! (kind of) – the entries of a directory are sorted before trying to load each one as either a package or module. This ensures packages are loaded first. Link to CPython source code
Jan 10, 2017 at 22:14 comment added kanaka @qff I tested it. I also tested python3 just now and it has the same behavior. A link to official documentation of the fact would be good. If you find one, please feel free to edit my answer or post a comment and I'll edit it.
Jan 10, 2017 at 21:56 comment added qff How do you know it takes precedence? – I couldn't find it in the Python documentation
Nov 3, 2010 at 23:07 history edited kanaka CC BY-SA 2.5
PYTHONPATH
Nov 3, 2010 at 23:01 history answered kanaka CC BY-SA 2.5

AltStyle によって変換されたページ (->オリジナル) /