class myFloat(float):
def __add__(self, value):
if type(value) is str:
return float.__add__(self, float(value))
else:
return float.__add__(self, value)
def __radd__(self, value):
return self.__add__(value)
x = myFloat(1.0)
print(x + '1.5')
Y2xhc3MgbXlGbG9hdChmbG9hdCk6CiAgICBkZWYgX19hZGRfXyhzZWxmLCB2YWx1ZSk6CiAgICAgICAgaWYgdHlwZSh2YWx1ZSkgaXMgc3RyOgogICAgICAgICAgICByZXR1cm4gZmxvYXQuX19hZGRfXyhzZWxmLCBmbG9hdCh2YWx1ZSkpCiAgICAgICAgZWxzZToKICAgICAgICAgICAgcmV0dXJuIGZsb2F0Ll9fYWRkX18oc2VsZiwgdmFsdWUpCiAgICAKICAgIGRlZiBfX3JhZGRfXyhzZWxmLCB2YWx1ZSk6CiAgICAgICAgcmV0dXJuIHNlbGYuX19hZGRfXyh2YWx1ZSkKICAgICAgICAKeCA9IG15RmxvYXQoMS4wKQpwcmludCh4ICsgJzEuNScp