From bc5dc9d0aeaf18c57506d2ed18df9d50cbf98068 2014-04-21 23:48:30 From: Jessica B. Hamrick Date: 2014-04-21 23:48:30 Subject: [PATCH] Do not record memory addresses of display objects in repr --- diff --git a/IPython/core/display.py b/IPython/core/display.py index 624f587..524ebb3 100644 --- a/IPython/core/display.py +++ b/IPython/core/display.py @@ -299,6 +299,7 @@ class DisplayObject(object): """An object that wraps data to be displayed.""" _read_flags = 'r' + _show_mem_addr = False def __init__(self, data=None, url=None, filename=None): """Create a display object given raw data. @@ -335,7 +336,15 @@ class DisplayObject(object): self.reload() self._check_data() - + + def __repr__(self): + if not self._show_mem_addr: + cls = self.__class__ + r = "<%s.%s object>" % (cls.__module__, cls.__name__) + else: + r = super(DisplayObject, self).__repr__() + return r + def _check_data(self): """Override in subclasses if there's something to check.""" pass