diff --git a/IPython/lib/pretty.py b/IPython/lib/pretty.py index 7a18f01..3a933d2 100644 --- a/IPython/lib/pretty.py +++ b/IPython/lib/pretty.py @@ -920,10 +920,20 @@ def _counter_pprint(obj, p, cycle): else: p.pretty(cls_ctor()) + +def _userlist_pprint(obj, p, cycle): + cls_ctor = CallExpression.factory(obj.__class__.__name__) + if cycle: + p.pretty(cls_ctor(RawText("..."))) + else: + p.pretty(cls_ctor(list(obj))) + + for_type_by_name('collections', 'defaultdict', _defaultdict_pprint) for_type_by_name('collections', 'OrderedDict', _ordereddict_pprint) for_type_by_name('collections', 'deque', _deque_pprint) for_type_by_name('collections', 'Counter', _counter_pprint) +for_type_by_name("collections", "UserList", _userlist_pprint) if __name__ == '__main__': from random import randrange