diff --git a/pynest/nest/lib/hl_api_types.py b/pynest/nest/lib/hl_api_types.py index 00118855f5..8a4ecf6a36 100644 --- a/pynest/nest/lib/hl_api_types.py +++ b/pynest/nest/lib/hl_api_types.py @@ -547,6 +547,13 @@ def __getattr__(self, attr): if not self: raise AttributeError("Cannot get attribute of empty NodeCollection") + # IPython looks up this method when doing pretty printing + # As long as we do not provide special methods to support IPython prettyprinting, + # HTML-rendering, etc, we stop IPython from time-consuming checks by raising an + # exception here. The exception must *not* be AttributeError. + if attr == "_ipython_canary_method_should_not_exist_": + raise NotImplementedError("_ipython_canary_method_should_not_exist_") + if attr == "spatial": metadata = sli_func("GetMetadata", self._datum) val = metadata if metadata else None