Hello guys,

On the latest code drop (43741) it seems that something is broken in
subclasses of floats.

class MyFloatType(float):
  def __new__(cls):
    return float.__new__(cls, 0.0)

  def __repr__(self):
    return "MyFloat"

  __str__ = __repr__

>>>MyFloat = MyFloatType()
>>>int(MyFloat)
TypeError: expected int, got p

This is one can be worked around by having an __int__ defined. However,

>>>str(MyFloat)
'0.0'
>>>repr(MyFloat)
'MyFloat'


Subclassing longs and ints in a similar way has the correct behaviour.

This is nasty and a blocker for us.

We've raised this as Issue 19675



Glenn & Orestis
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to