Show More
@@ -115,9 +115,15 b' def display(*objs, **kwargs):' | |||
|
115 | 115 | |
|
116 | 116 | for obj in objs: |
|
117 | 117 | |
|
118 |
# If _ipython_display_ is defined, use that to display this object. |
|
|
119 | # it returns NotImplemented, use the _repr_ logic (default). | |
|
120 | if not hasattr(obj, '_ipython_display_') or obj._ipython_display_(**kwargs) is NotImplemented: | |
|
118 | # If _ipython_display_ is defined, use that to display this object. | |
|
119 | display_method = getattr(obj, '_ipython_display_', None) | |
|
120 | if display_method is not None: | |
|
121 | try: | |
|
122 | display_method(**kwargs) | |
|
123 | except NotImplementedError: | |
|
124 | pass | |
|
125 | else: | |
|
126 | continue | |
|
121 | 127 |
|
|
122 | 128 |
|
|
123 | 129 |
|
@@ -241,9 +241,14 b' class DisplayHook(Configurable):' | |||
|
241 | 241 | """ |
|
242 | 242 | self.check_for_underscore() |
|
243 | 243 | if result is not None and not self.quiet(): |
|
244 |
# If _ipython_display_ is defined, use that to display this object. |
|
|
245 | # it returns NotImplemented, use the _repr_ logic (default). | |
|
246 | if not hasattr(result, '_ipython_display_') or result._ipython_display_() is NotImplemented: | |
|
244 | # If _ipython_display_ is defined, use that to display this object. | |
|
245 | display_method = getattr(result, '_ipython_display_', None) | |
|
246 | if display_method is not None: | |
|
247 | try: | |
|
248 | return display_method() | |
|
249 | except NotImplementedError: | |
|
250 | pass | |
|
251 | ||
|
247 | 252 |
|
|
248 | 253 |
|
|
249 | 254 |
|
General Comments 0
You need to be logged in to leave comments.
Login now