jupyter / jupyter/notebook

Bug when retrieving docstring with __getitem__

Open
#3,741 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
13.3k
Forks
5.8k
Avg merge
6d 11h
Merged PRs (30d)
7

Description

python 3.6.4
IPython 6.2.1

```python
class Foo(object):
def __getitem__(self, key):
return key**2

f = Foo()
f[2].clear??
```

Returns the following docstring
```
Source:
@line_magic
def clear(self, arg_s):
"""Clear the terminal."""
if os.name == 'posix':
self.shell.system("clear")
else:
self.shell.system("cls")
File: c:\\lib\site-packages\ipykernel\zmqshell.py
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the provided Foo class and the f[2].clear?? expression, then inspect how docstrings are retrieved around ipykernel/zmqshell.py. Done means the expression no longer returns the unrelated clear terminal docstring, though the issue does not identify a test or target source file.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.