[IPython-user] Problem with ? and ?? in ipython combined with paging
Tom Denniston
tom.denniston at alum.dartmouth.org
Fri Jan 5 13:26:44 CST 2007
Much of my code contains long descriptive docstring with many tests.
There is a great feature that I love in ipython where if you have a
func and you type "func?" it give a pretty colored docstring that is
incredibly useful. The nagging problem I face is that if the
docstring is larger than 25 lines then it invokes the python pager and
the pretty docstring becomes a garbled mess of "ESC[1;31", etc.
Below is a docstring that works and one that does and the code that
produced both. I was wondering whether this is a bug in the python
pager or ipython and if there is anything that can be done.
I am using ipython 0.7.3b2.r1970. I have seen the problem in every
previous release I have used, though, so it is not a new problem.
I've been using IPython for over a year and a half and it is a
phenomenal tool. Thanks Fernando, et al. for developing something
really awesome.
--Tom
In [37]: test.testFuncLessThanTerminalNoPage?
Type: function
Base Class: <type 'function'>
String Form: <function testFuncLessThanTerminalNoPage at 0x35b08b4>
Namespace: Interactive
File: /home/tdennist/code2/fstrat/src/test.py
Definition: test.testFuncLessThanTerminalNoPage()
Docstring:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Now if I use a function that has a docstring larger than the default
terminal size it uses the pager and craps out on the formatting. I
see:
In [38]: test.testFuncLargerThanTerminalPage?
ESC[1;31mType: ESC[0mfunction
ESC[1;31mBase Class: ESC[0m<type 'function'>
ESC[1;31mString Form:ESC[0m <function
testFuncLargerThanTerminalPage at 0x35b00d4>
ESC[1;31mNamespace: ESC[0mInteractive
ESC[1;31mFile: ESC[0m/home/tdennist/code2/fstrat/src/test.py
ESC[1;31mDefinition:
ESC[0mESC[1;37mtestESC[0mESC[1;33m.ESC[0mESC[1;37mtestFuncLargerThanTerminalPageESC[0mESC[1;33m(ESC[0mESC[1;33m)ESC[0mESC[1;33mESC[0m
ESC[0m
ESC[1;31mDocstring:
ESC[0m 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Here are the two test functions:
def testFuncLessThanTerminalNoPage():
'''
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'''
def testFuncLargerThanTerminalPage():
'''
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'''
More information about the IPython-user
mailing list