Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce unhelpful information shown by pinfo #2028

Merged
merged 2 commits into from Jun 25, 2012

Conversation

takluyver
Copy link
Member

I've noticed recently that object introspection often shows information that's not very helpful, pushing the docstring and signature further down. In particular, 'Base Class' is redundant with 'Type' except for instances of old style classes, and 'Namespace: Interactive' is almost always the case. This clears those things up when appropriate.

I'm intending this for 0.14 now, but it's small enough that it could go into 0.13 if we want it.

Before:

In [2]: random.randint?
Type:       instancemethod
Base Class: <type 'instancemethod'>
String Form:<bound method Random.randint of <random.Random object at 0x95f38f4>>
Namespace:  Interactive
File:       /usr/lib/python2.7/random.py
Definition: random.randint(self, a, b)
Docstring:
Return random integer in range [a, b], including both end points.

After:

In [2]: random.randint?
Type:       instancemethod
String Form:<bound method Random.randint of <random.Random object at 0x84da8f4>>
File:       /usr/lib/python2.7/random.py
Definition: random.randint(self, a, b)
Docstring:
Return random integer in range [a, b], including both end points.

@takluyver
Copy link
Member Author

Test results for commit 4e7dbac merged into master
Platform: linux2

  • python2.7: Failed, log at https://gist.github.com/2984764 (libraries not available: oct2py rpy2)
  • python3.1: OK (libraries not available: cython matplotlib numpy oct2py pymongo qt rpy2 wx wx.aui zmq)
  • python3.2: OK (libraries not available: cython oct2py pymongo rpy2 wx wx.aui)

Not available for testing: python2.6

@fperez
Copy link
Member

fperez commented Jun 25, 2012

Test results for commit 4e7dbac merged into master
Platform: linux2

  • python2.7: OK
  • python3.2: OK (libraries not available: cython matplotlib oct2py pygments pymongo rpy2 wx wx.aui)

Not available for testing: python2.6, python3.1

@fperez
Copy link
Member

fperez commented Jun 25, 2012

I'm OK with this going in, it indeed removes mostly useless/redundant info. Code reviewed, looks good. Merging now. Thanks!

fperez added a commit that referenced this pull request Jun 25, 2012
Reduce unhelpful information shown by pinfo: simply removes a few fields such as namespace (that is just 'Interactive' most of the time) or 'Base Class' from the report except when they have unusual values that may be informative to report.
@fperez fperez merged commit 9a628cd into ipython:master Jun 25, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Reduce unhelpful information shown by pinfo: simply removes a few fields such as namespace (that is just 'Interactive' most of the time) or 'Base Class' from the report except when they have unusual values that may be informative to report.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants