##// END OF EJS Templates
Added custom pprint to pretty print collections.UserList like regular lists....
007vedant -
Show More
@@ -920,10 +920,20 b' def _counter_pprint(obj, p, cycle):'
920 920 else:
921 921 p.pretty(cls_ctor())
922 922
923
924 def _userlist_pprint(obj, p, cycle):
925 cls_ctor = CallExpression.factory(obj.__class__.__name__)
926 if cycle:
927 p.pretty(cls_ctor(RawText("...")))
928 else:
929 p.pretty(cls_ctor(list(obj)))
930
931
923 932 for_type_by_name('collections', 'defaultdict', _defaultdict_pprint)
924 933 for_type_by_name('collections', 'OrderedDict', _ordereddict_pprint)
925 934 for_type_by_name('collections', 'deque', _deque_pprint)
926 935 for_type_by_name('collections', 'Counter', _counter_pprint)
936 for_type_by_name("collections", "UserList", _userlist_pprint)
927 937
928 938 if __name__ == '__main__':
929 939 from random import randrange
General Comments 0
You need to be logged in to leave comments. Login now