Opened 13 years ago

Closed 13 years ago

#4040 closed (fixed)

make use of in instead of has_key()

Reported by: Gary Wilson <gary.wilson@…> Owned by: Adrian Holovaty
Component: Core (Other) Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


has_key() is slower and will be going away in python3.

Attachments (1)

4040.diff (39.0 KB) - added by Gary Wilson <gary.wilson@…> 13 years ago.
replaced most has_key()'s with in

Download all attachments as: .zip

Change History (6)

Changed 13 years ago by Gary Wilson <gary.wilson@…>

Attachment: 4040.diff added

replaced most has_key()'s with in

comment:1 Changed 13 years ago by Gary Wilson <gary.wilson@…>

Triage Stage: UnreviewedDesign decision needed

There are a couple has_key() calls in dispatcher package, but I wasn't sure if we are keeping that in sync with upstream or not. All tests passed for me, but I wouldn't be surprised if not all the changes are covered by a test.

comment:2 Changed 13 years ago by Simon G. <dev@…>

Triage Stage: Design decision neededReady for checkin

I think this would be good to get in for future proofing reasons (and speed!). Shouldn't raise any bugs that I can think of.

comment:3 Changed 13 years ago by Malcolm Tredinnick

Triage Stage: Ready for checkinAccepted

Does this depend on #4041 at all? It's not clear what the relationship is between this ticket and that one? Moving back to "accepted" until that is clarified.

This is pretty low priority, since the speed difference between the two versions is tiny for all practical purposes and Python 3000 doesn't exist yet (and will require more than one or two changes to our code). However, it's probably worth putting in at some point.

comment:4 Changed 13 years ago by Gary Wilson <gary.wilson@…>

This ticket is independent of #4041 since Django itself doesn't actually use the cache framework (except for in the tests, but there is no use of 'in' in the cache tests).

comment:5 Changed 13 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [5091]) Fixed #4040 -- Changed uses of has_key() to "in". Slight performance
improvement and forward-compatible with future Python releases. Patch from Gary

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