[Python-Dev] python 3 niggle: None < 1 raises TypeError

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Feb 18 22:17:00 CET 2014

Georg Brandl wrote:
> Seeing how you need a key function in any case for this sort to work,
> it's only the "or mindate" added, which I can't recognize as "ridiculous
> amount of boilerplate".

Well, I don't much like having to construct a key
function in the first place for something as common
as sorting on an attribute.

Also, in the particular case of dates, there's the
annoying fact that the datetime module doesn't
provide any kind of null object that can be compared
with datetimes, so you have to make a fake one

All of these small annoyances add up to what is, for
me, a fairly big annoyance.

What I'd *really* like to be able to write is:

    sort(invoices, keyattr = 'duedate', none = 'first')


More information about the Python-Dev mailing list