Skip to content
This repository

pprinting old-style class objects fails (TypeError: 'tuple' object is not callable) #1074

kcarnold opened this Issue November 30, 2011 · 1 comment

2 participants

Kenneth C. Arnold Min RK
Kenneth C. Arnold
In [1]: class A: pass
In [2]: A
/Users/kcarnold/.virtualenvs/py27/lib/python2.7/site-packages/IPython/lib/pretty.pyc in pretty(self, obj)
    341             for cls in _get_mro(obj_class):
    342                 if cls in self.type_pprinters:
--> 343                     return self.type_pprinters[cls](obj, self, cycle)
    344                 else:
    345                     printer = self._in_deferred_types(cls)

TypeError: 'tuple' object is not callable

Unfortunately some classes in the Python standard library are old-style, so I stumbled across this one.

The fix is trivial and hardly worth a pull request:

diff --git a/IPython/lib/ b/IPython/lib/
index 4361f21..f6f109c 100644
--- a/IPython/lib/
+++ b/IPython/lib/
@@ -668,7 +668,7 @@ _type_pprinters = {

     _type_pprinters[types.DictProxyType] = _dict_pprinter_factory('<dictproxy {', '}>')
-    _type_pprinters[types.ClassType] = _type_pprint,
+    _type_pprinters[types.ClassType] = _type_pprint
 except AttributeError: # Python 3
Min RK minrk closed this in 13c8185 November 30, 2011
Min RK

thanks, fix pushed.

Brian E. Granger ellisonbg referenced this issue from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.