This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Marco Sulla
Recipients Marco Sulla, brandtbucher, cheryl.sabella, mark.dickinson, rhettinger, serhiy.storchaka, tim.peters
Date 2019-12-15.18:46:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1576435613.17.0.298859440779.issue36095@roundup.psfhosted.org>
In-reply-to
Content
I'm in favor of a `math.total_ordering` function, but IMHO sorting functions should emit a warning if they contains an unorderable objects.

This can be done easily: I suppose the sorting function checks if the objects of the iterable are minor that another object. And soon or later, this check will be done for all objects in the iterable.

What I propose is simply to add a flag `all_orderables`, true by default.

After the current object a is checked against the object b, if `all_orderables` is true, another check will be performed: `a >= b`?

If this return false, `all_orderables` will be set to false.

At the end of sorting, if `all_orderables` is false, a warning will be emitted.

This way, no old code will break, but developers will be informed of the problem. Because "Errors should never pass silently" :)
History
Date User Action Args
2019-12-15 18:46:53Marco Sullasetrecipients: + Marco Sulla, tim.peters, rhettinger, mark.dickinson, serhiy.storchaka, cheryl.sabella, brandtbucher
2019-12-15 18:46:53Marco Sullasetmessageid: <1576435613.17.0.298859440779.issue36095@roundup.psfhosted.org>
2019-12-15 18:46:53Marco Sullalinkissue36095 messages
2019-12-15 18:46:52Marco Sullacreate