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

get _ipython_display_ method safely #5229

Merged
merged 1 commit into from Feb 27, 2014

Conversation

minrk
Copy link
Member

@minrk minrk commented Feb 26, 2014

use the same method we use for _repr_foo_

closes #5227

@Zaharid
Copy link
Contributor

Zaharid commented Feb 26, 2014

Cool. This PR is working for me.

@@ -64,7 +64,9 @@ def _valid_formatter(f):
- unbound methods NO
- callable with zero args OK
"""
if isinstance(f, type(str.find)):
if f is None:
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return False, to keep the API consistent

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, that's because I moved the clause from the new function below. Good catch, fixed.

@takluyver
Copy link
Member

Other than that, looks good.

use the same method we use for `_repr_foo_`
@damianavila
Copy link
Member

Yep, LGTM too...

takluyver added a commit that referenced this pull request Feb 27, 2014
get _ipython_display_ method safely
@takluyver takluyver merged commit f286289 into ipython:master Feb 27, 2014
@minrk minrk deleted the safe-get-ipdisplay branch March 31, 2014 23:36
@mphre
Copy link

mphre commented Apr 28, 2014

Hi, this only works if the returned object is not callable. Is there a way to tell IPython to avoid trying to use that method at all (or on some classes/objects)?
(I'm working with python networkmanager module which returns functions which are proxies for DBus calls on getattr)

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
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.

display_method of objects with custom __getattr__
5 participants