Shyam Sunder
Shyam Sunder

Reputation: 1240

automatically do print when viewing __doc__

Can I change the config file to automatically do a print when I'm viewing docstrings?

Contrast 6 and 7 on the iPython console below.

In [6]: zip.__doc__
Out[6]: 'zip(seq1 [, seq2 [...]]) -> [(seq1[0], seq2[0] ...), (...)]\n\nReturn a list of tuples, where each tuple contains the i-th element\nfrom each of the argument sequences.  The returned list is truncated\nin length to the length of the shortest argument sequence.'

In [7]: print zip.__doc__
zip(seq1 [, seq2 [...]]) -> [(seq1[0], seq2[0] ...), (...)]

Return a list of tuples, where each tuple contains the i-th element
from each of the argument sequences.  The returned list is truncated
in length to the length of the shortest argument sequence.

Thanks.

Upvotes: 1

Views: 52

Answers (1)

punchagan
punchagan

Reputation: 5846

IPython already does that for you. Use ? instead of checking __doc__.

In [1]: zip?

Upvotes: 1

Related Questions