Consider the Python.
I’ve been writing a lot of it recently. It’s mostly quite nice, but there are some quirks I rather dislike.
Python doesn’t do so well on this front. This is sad given that it really loves its exceptions.
>>> float() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: float() argument must be a string or a number
This error message has the lovely property of being both completely unhelpful and a lie.
It is unhelpful because it does not give you any information at all (not even a type) about the value you tried to convert to a float.
It is a lie because in fact all manner of things can be converted to floats:
>>> class Foo(object): ... def __float__(self): ... return 42.0 ... >>> Foo() <__main__.Foo object at 0x27ac910> >>> float(Foo()) 42.0
I wonder how we could better design this message to mislead? I’m drawing a blank here.