[docs] [issue30535] Warn that meta_path is not empty

Xavier Morel report at bugs.python.org
Thu Jun 1 04:59:10 EDT 2017


New submission from Xavier Morel:

Encountered this issue porting Python 2 code manipulating meta_path to Python 3.

In Python 2, meta_path is empty by default and its documentation specifically notes that:

> sys.meta_path is searched before any implicit default finders or sys.path.

As a result, sys.meta_path.append() works perfectly well and is overwhelmingly common[0].

In Python 3, this note was removed but the documentation does not specifically state default finders are present in meta_path, and the old code using sys.meta_path.append may now break as the default finders will silently take precedence on the custom ones if they believe they can do the job.

I'd like to add a warning to the Python 3 documentation (3.5+?) noting the presence of existing default loaders, and to the Python 2 documentation suggesting `sys.meta_path.insert(0, finder)` for future-proofing, would there be objections or issues?

[0] https://github.com/search?q=meta_path.append&type=Code&utf8=✓

----------
assignee: docs at python
components: Documentation
messages: 294919
nosy: docs at python, xmorel
priority: normal
severity: normal
status: open
title: Warn that meta_path is not empty
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6

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


More information about the docs mailing list