> class vec2d(ctypes.Structure): > """2d vector class, supports vector and scalar operators, > and also provides a bunch of high level functions > """ > __slots__ = ['x', 'y'] > > def __init__(self, x_or_pair, y = None): > > if y == None: > self.x = x_or_pair[0] > self.y = x_or_pair[1] > else: > self.x = x_or_pair > self.y = y
I may be way off here, but why does vec2d inherit from ctypes.Structure if it doesn't observe the protocol for Structures (they're supposed to have _fields_, not __slots__)? -- http://mail.python.org/mailman/listinfo/python-list