You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def do_inspect(self, code, cursor_pos, detail_level=0):
name = token_at_cursor(code, cursor_pos)
info = self.shell.object_inspect(name) # computes the complete info
[...]
if info['found']:
info_text = self.shell.object_inspect_text(
name,
detail_level=detail_level,
) # computes it again as a first step
data['text/plain'] = info_text
[...]
IMO it would be ok to replace the first self.shell.object_inspect(...) with a info = self.shell._object_find(name) and then use if info.found:. The problem is I don't understand what the with self.builtin_trap: in the object_inspect method does (source) and if that's already needed for self.shell._object_find.
The text was updated successfully, but these errors were encountered:
jankatins
changed the title
ipykernel inspect lets ipython compute the info twice
do_inspect lets ipython compute the info twice
Sep 5, 2015
That makes good sense to me. I just want to avoid calling private APIs in IPython from ipykernel. I think we need to take a pass on oinspect in IPython to make a few more ways to call its pieces.
Found this while trying to understand what is needed to make a decorated method get the same signature/completions as the original one, even on py2.7.
From https://github.com/ipython/ipykernel/blob/master/ipykernel/ipkernel.py#L247:
IMO it would be ok to replace the first
self.shell.object_inspect(...)
with ainfo = self.shell._object_find(name)
and then useif info.found:
. The problem is I don't understand what thewith self.builtin_trap:
in theobject_inspect
method does (source) and if that's already needed forself.shell._object_find
.The text was updated successfully, but these errors were encountered: