[Python-ideas] Unhelpful error message from sorted

Terry Reedy tjreedy at udel.edu
Tue May 15 08:52:26 CEST 2012


On 5/14/2012 8:04 PM, Chris Rebert wrote:
> On Mon, May 14, 2012 at 4:28 PM, Michael Foord<fuzzyman at gmail.com>  wrote:
>> Hello all,
>>
>> It seems to me that the following error message, whilst technically correct,
>> is unhelpful:
>>
>>>>> sorted([3, 2, 1], reverse=None)
>> Traceback (most recent call last):
>>    File "<stdin>", line 1, in<module>
>> TypeError: an integer is required
>>
>> Worth creating an issue for?
>
> IMO, yes. Surely a *bool[ean]* value ought to be required.
> (And mentioning the `reverse` parameter by name would of course also be nice.)

There are still overly cryptic errors messages. I would like to see 
something more like
TypeError: 'reverse' argument must be bool, not Nonetype

-- 
Terry Jan Reedy




More information about the Python-ideas mailing list