Message 72141 - Python tracker (original) (raw)
On Python 3.0:
class C: ... def len(self): return "foo" ... len(C()) Traceback (most recent call last): File "", line 1, in SystemError: Objects/longobject.c:433: bad argument to internal function
On Python 2.6 the behaviour is different for old and new-style classes, with old-style classes giving the more informative error message and both accepting (and truncating) floats.
I attached a patch for Python 3.0, which refuses everything but ints and gives an informative error message. Or does the float-truncating behaviour of Python 2.x need to be preserved?