class Info(object):
    __slots__ = ['x', 'y', 'z']

def swap(self):
    newObj = self.copy()
newObj.x, newObj.y = self.y, self.x
return newObj

def copy(self):
    clone = type(self)()
for slot in self.__slots__:
    if hasattr(self, slot):
        setattr(clone, slot, getattr(self, slot))
return clone
Immutable object design for performance