Opened 5 years ago

Closed 5 years ago

#12746 closed (fixed)

Use key argument in sort calls

Reported by: loewis Owned by: nobody
Component: Uncategorized Version: 1.2-alpha
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Now that Python 2.4 is the minimum supported version, it is possible to replace all comparison functions with key functions. The attached patch does that.

Doing so has two advantages:

  • it may be slightly faster, in particular, if the comparing the key values is faster than calling the cmp function
  • it helps moving Django towards Python 3, which doesn't support the compare function anymore.

With the patch, I don't get any additional failures when testing on trunk.

Attachments (1)

key.diff (5.5 KB) - added by loewis 5 years ago.

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by loewis

comment:1 Changed 5 years ago by Alex

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 5 years ago by loewis

As this is my first Django contribution, I'm not sure what is supposed to happen next. Notice that I don't have commit privileges, so I couldn't check that in myself.

comment:3 Changed 5 years ago by kmtracey

http://docs.djangoproject.com/en/dev/internals/contributing/#ticket-triage has a picture and some description of Django's process. You weren't expected to check it in yourself, Alex setting it ready for checkin is just a way to signal he has reviewed it and thinks it's ready.

comment:4 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [13509]) Fixed #12746 -- Updated sorting calls to use 'key' instead of 'cmp'. This will be slightly faster in certain circumstances, but more importantly, is a required step for migration to Python 3. Thanks to Martin van Loewis for the patch.

Note: See TracTickets for help on using tickets.
Back to Top