Opened 13 years ago

Closed 11 years ago

Last modified 11 years ago

#18315 closed Cleanup/optimization (fixed)

Document QueryDict.pop & popitem

Reported by: gcbirzan Owned by: nobody
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

All the 'regular' operations on QueryDict return a single value, with a 'list' variant for returning a list of items. pop() pops a list, popitem() for just one item. This is not only inconsistent, but also not documented.

I'd prefer a solution that makes pop return a single item, vs mentioning it in the docs, but that breaks backwards compatibility.

Change History (10)

comment:1 by Aymeric Augustin, 12 years ago

Triage Stage: UnreviewedDesign decision needed

I'm not convinced this is a sufficient reason to break backwards compatibility.

comment:2 by anonymous, 12 years ago

This confused me to no end before I found out that doing QueryDictkey would not return the same value as QueryDict.pop('key'). This hardly seems like it conform with other uses of pop.

comment:3 by _ado, 12 years ago

Given a QueryDict d={'k':['a', 'b'], 'v':['1', '2']} then d.get('k')='a', but d.pop('k')=['a', 'b']
I've been using pop() to get me the list of values. Changing the functionality would be a backwards compatibility problem, indeed. I recommend to update the documentation instead.

comment:4 by Aymeric Augustin, 12 years ago

Type: UncategorizedCleanup/optimization

comment:5 by Aymeric Augustin, 12 years ago

Triage Stage: Design decision neededAccepted

OK, let's fix this.

comment:6 by Tim Graham, 11 years ago

Component: HTTP handlingDocumentation
Easy pickings: set
Summary: QueryDict.pop is inconsistentDocument QueryDict.pop & popitem

comment:7 by Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: newclosed

In fdef471912022dd5d65946fa6f86adbc3c60f630:

[1.5.x] Fixed #18315 -- Documented QueryDict.popitem and QueryDict.pop

Thanks gcbirzan for the report.

Backport of 8c9240222f from master

comment:8 by Tim Graham <timograham@…>, 11 years ago

In f3a961f009afe4f1be4a5bb6d5c37c98c30fed41:

[1.4.x] Fixed #18315 -- Documented QueryDict.popitem and QueryDict.pop

Thanks gcbirzan for the report.

Backport of 8c9240222f from master

comment:9 by Tim Graham <timograham@…>, 11 years ago

In ec6928be3430e5113a888da43a9b386f85add40b:

[1.6.x] Fixed #18315 -- Documented QueryDict.popitem and QueryDict.pop

Thanks gcbirzan for the report.

Backport of 8c9240222f from master

comment:10 by Tim Graham <timograham@…>, 11 years ago

In 8c9240222fd882d9ae3819ff289989df1bcd05d7:

Fixed #18315 -- Documented QueryDict.popitem and QueryDict.pop

Thanks gcbirzan for the report.

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