[issue36892] "Modules" section in Tutorial contains incorrect description about __init__.py
New submission from musou1500 <musou1500@gmail.com>: "Modules" section in the tutorial says that https://docs.python.org/3/tutorial/modules.html "The __init__.py files are required to make Python treat directories containing the file as packages. " But, thanks to PEP 420, __init__.py is not required after Python 3.3. https://www.python.org/dev/peps/pep-0420/ ---------- assignee: docs@python components: Documentation messages: 342228 nosy: docs@python, musou1500 priority: normal severity: normal status: open title: "Modules" section in Tutorial contains incorrect description about __init__.py type: enhancement versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36892> _______________________________________
Steven D'Aprano <steve+python@pearwood.info> added the comment: In my experience, beginners have enough trouble getting packages right without complicating the tutorial with a rarely-used advanced feature like namespace packages. I don't think this needs more than perhaps a footnote, if that. ---------- nosy: +steven.daprano _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36892> _______________________________________
Ezio Melotti <ezio.melotti@gmail.com> added the comment: I agree that implicit namespace packages don't deserve more than a footnote in that page. However, since I often have to answer questions about packages, I'm thinking that perhaps it would be better to expand that page and maybe have a page dedicated to modules and one to packages, where PEP 420 and other common issues could be covered in more details. ---------- nosy: +ezio.melotti _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36892> _______________________________________
Inada Naoki <songofacandy@gmail.com> added the comment: I think it is just a noise for the tutorial readers. I created a post about misunderstanding of PEP 420. https://dev.to/methane/don-t-omit-init-py-3hga How about adding note in top of the PEP 420 instead? .. note:: Namespace packages are not regular packages. It is a feature for very special use case. Don't omit ``__init__.py`` in regular packages. ---------- nosy: +inada.naoki _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36892> _______________________________________
participants (4)
-
Ezio Melotti -
Inada Naoki -
musou1500 -
Steven D'Aprano