def force_float(name):

    def get(self):
        return getattr(self, name)

def set(self, x):
    setattr(self, name, float(x))
return property(get, set)


class Vector(object):
    x = force_float('_x')
y = force_float('_y')
Can I add parameters to a python property to reduce code duplication?