[Python-ideas] Unhelpful error message from sorted

Chris Rebert pyideas at rebertia.com
Tue May 15 02:04:04 CEST 2012


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.)

Cheers,
Chris



More information about the Python-ideas mailing list