[docs] [issue26160] Tutorial incorrectly claims that (explicit) relative imports don't work in the main module

Kevin Norris report at bugs.python.org
Sat Jan 23 19:45:27 EST 2016


Kevin Norris added the comment:

>It could be misleading saying “the name of the current package”, because the import could be relative to the a higher level parent package if more than one dot is specified.

While this is correct, Python still uses __package__ to determine what to import in that case.  I simply replaced "__package__" with "the name of the current package" to make it easier to read, much as the original text replaces "__name__" with "the name of the current module."

>Then point out that relative imports won’t work with ``python file.py`` or interactive mode, but don’t mention “-m” (or the other ways to run scripts and modules).

SGTM if you can find a reasonable way of phrasing that.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26160>
_______________________________________


More information about the docs mailing list