##// END OF EJS Templates
Struct no pprints the dict inside it
vivainio -
Show More
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Mimic C structs with lots of extra functionality.
3 3
4 $Id: ipstruct.py 1949 2006-11-28 19:12:15Z vivainio $"""
4 $Id: ipstruct.py 1950 2006-11-28 19:15:35Z vivainio $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
@@ -17,6 +17,7 b' __license__ = Release.license'
17 17 __all__ = ['Struct']
18 18
19 19 import types
20 import pprint
20 21
21 22 from IPython.genutils import list2dict2
22 23
@@ -138,13 +139,13 b' class Struct:'
138 139 def __str__(self):
139 140 """Gets called by print."""
140 141
141 return 'Struct('+str(self.__dict__)+')'
142 return 'Struct('+ pprint.pformat(self.__dict__)+')'
142 143
143 144 def __repr__(self):
144 145 """Gets called by repr.
145 146
146 147 A Struct can be recreated with S_new=eval(repr(S_old))."""
147 return 'Struct('+str(self.__dict__)+')'
148 return self.__str__()
148 149
149 150 def __getitem__(self,key):
150 151 """Allows struct[key] access."""
General Comments 0
You need to be logged in to leave comments. Login now