-3

For what i can use the "." in import module. I meet it in sklearn library. It looks like:

from .externals import six
roganjosh
  • 12,594
  • 4
  • 29
  • 46
J. Doe
  • 1
  • 1
  • Read [this](https://stackoverflow.com/questions/48304317/how-do-implicit-relative-imports-work-in-python) SO post and [PEP 328](https://www.python.org/dev/peps/pep-0328/). – pstatix Jul 22 '18 at 06:37

1 Answers1

-1

The . is a shortcut that tells it search in current package before rest of the PYTHONPATH. So, if a same-named module Recipe exists somewhere else in your PYTHONPATH, it won't be loaded.

J. Doe
  • 1
  • 1
  • *"search in current package before rest of the PYTHONPATH"* That is incorrect. A `.` import is a relative import; the PYTHONPATH isn't searched *at all*. – Aran-Fey Jul 22 '18 at 06:52
  • 1
    This answer is completely wrong on so many levels.. – Taku Jul 22 '18 at 06:56