Opened 6 years ago

Closed 4 years ago

Last modified 4 years ago

#29356 closed Cleanup/optimization (fixed)

request.GET.getlist default is [] instead of None

Reported by: JorisBenschop Owned by: Paul Grau
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

from https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.QueryDict.getlist:

QueryDict.getlist(key, default=None)¶
Returns a list of the data with the requested key. Returns an empty list if the key doesn’t exist and a default value wasn’t provided

As far as I know an empty list, [] is not the same as None. should it thus not be rewritten as:

QueryDict.getlist(key, default=[ ])¶


Change History (7)

comment:1 by Simon Charette, 6 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Tim Graham, 6 years ago

I'm not sure -- you think we should document that something that differs from the actual signature?

comment:3 by Claude Paroz, 6 years ago

Resolution: invalid
Status: newclosed

Agreed with Tim, the signature is right, the return value is explained in the paragraph. I can understand the confusion because the default default value is not the default return value.

comment:4 by Carlton Gibson, 4 years ago

Has patch: set
Resolution: invalid
Status: closednew

There's a PR with a small adjustment to the docs come in for this, which seems acceptable, so reopening to take that.

comment:5 by Carlton Gibson, 4 years ago

Owner: changed from nobody to Paul Grau
Status: newassigned
Triage Stage: AcceptedReady for checkin

comment:6 by GitHub <noreply@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In 855fc062:

Fixed #29356 -- Clarified docs for QueryDict.getlist() default.

comment:7 by Carlton Gibson <carlton.gibson@…>, 4 years ago

In b0e5e7b6:

[3.1.x] Fixed #29356 -- Clarified docs for QueryDict.getlist() default.

Backport of 855fc06236630464055b4f9ea422c68a07c6d02a from master

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