News for hackers. Stuff that matters.
Re:How the Python import system works by kdmccormick on Saturday July 24, 2021 @07:55PM (#27945404)
Nice, do you know of anything similarly-comprehensive that is updated for Python 3? IIRC, Python 3 simplified things a good deal by removing "implicit" relative imports, but I'm a little foggy on exactly what that means.
Re:How the Python import system works by Izkata on Sunday July 25, 2021 @03:35AM (#27947467)
Explicit relative imports use a "." to indicate the file/package is from the current directory and not found elsewhere in sys.path:

  from . import foo
  from .foo import bar
Implicit relative imports don't have such an indicator:

  from foo import bar
In py2, that second one could be a relative import or from anywhere in sys.path, while in py3 those implicit relative imports were removed so that means it'll only only look in sys.path and not the local directory.

https://stackoverflow.com/questions/48716943/what-is-python-...

Re:How the Python import system works by masklinn on Sunday July 25, 2021 @07:54AM (#27948482)
> IIRC, Python 3 simplified things a good deal by removing "implicit" relative imports, but I'm a little foggy on exactly what that means.

Exactly that: in Python 3, if an import doesn’t start with a . it will always be absolute aka looked up from sys.path.

In python 2, it would try performing a relative import (so importing a sibling module) first.