I have a ctypes structure.
class S1 (ctypes.Structure): _fields_ = [ (\'A\', ctypes.c_uint16 * 10), (\'B\', ctypes.c_uint32), (\'C\',
How about something like:
class S1(ctypes.Structure): _fields_ = [ ... ] def getdict(self): dict((f, getattr(self, f)) for f, _ in self._fields_)