[New-bugs-announce] [issue37422] Documentation on the change of __path__ in Python 3

Jim Li report at bugs.python.org
Wed Jun 26 19:46:04 EDT 2019


New submission from Jim Li <jimli at bcgsc.ca>:

In Python 2, `__path__` used to be a list, so all of the operations available to list are available, e.g., `insert`; you can also do indexing; e.g., `__path__[0]`.

However, I believe that starting from Python 3, it seems to be a <class '_frozen_importlib_external._NamespacePath'>, and a lot of operations that worked previously stopped working.It seems so abruptive and I can't find any deprecation notice on this.

Previously, one is able to insert an additional path to the front of the list by doing

module.__path__.insert(0, 'src/mypath')

Now the only procedure allowed seems to be append. Is there any way to mimic the old behaviour? Sorry, this is my first question so maybe this issue doesn't deserve any more attention. If there is any documentation that talks about the change of type of the NamespacePath, please kindly lemme know.

Sincerely,

Related issues include https://bugs.python.org/issue35843

----------
assignee: docs at python
components: Documentation
messages: 346701
nosy: docs at python, jimli
priority: normal
severity: normal
status: open
title: Documentation on the change of __path__ in Python 3
versions: Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37422>
_______________________________________


More information about the New-bugs-announce mailing list