Hello guys,<br>
<br>On the latest code drop (43741) it seems that something is broken in subclasses of floats. <br>
<br>
class MyFloatType(float):<br>
def __new__(cls):<br>
return float.__new__(cls, 0.0)<br>
<br>
def __repr__(self):<br>
return "MyFloat"<br>
<br>
__str__ = __repr__<br>
<br>
>>>MyFloat = MyFloatType()<br>
>>>int(MyFloat)<br>
TypeError: expected int, got p<br>
<br>
This is one can be worked around by having an __int__ defined. However,<br>
<br>
>>>str(MyFloat)<br>
'0.0'<br>
>>>repr(MyFloat)<br>
'MyFloat'<br>
<br><br>
Subclassing longs and ints in a similar way has the correct behaviour.<br><br>
This is nasty and a blocker for us.<br><br>We've raised this as Issue 19675<br><br><br><br>Glenn & Orestis<br>