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

Martin Panter report at bugs.python.org
Wed Jan 20 05:29:46 EST 2016

Martin Panter added the comment:

Yes 2.7 is open for changes to the documentation like this, as is 3.5+.

It’s been a while since I looked at the tutorial. Does it even mention the “python -m” mode? I don’t think this is the right place to introduce it.

Perhaps it would be okay to just say relative imports are based on the _full_ name of the current module. 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. 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).

nosy: +martin.panter
versions:  -Python 3.2, Python 3.3, Python 3.4

Python tracker <report at bugs.python.org>

More information about the docs mailing list