From ab9b31f94737895f0121f26ba3ad718ebbc24fe1 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Fri, 8 Mar 2019 10:58:00 -0800 Subject: bpo-35843: Implement __getitem__ for _NamespacePath (GH-11690) --- Lib/importlib/_bootstrap_external.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Lib/importlib') diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 71fdd0cb59..146c6472f7 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1163,6 +1163,9 @@ class _NamespacePath: def __iter__(self): return iter(self._recalculate()) + def __getitem__(self, index): + return self._recalculate()[index] + def __setitem__(self, index, path): self._path[index] = path -- cgit v1.2.1