#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 , 7 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 7 years ago
comment:3 by , 7 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
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 , 4 years ago
Has patch: | set |
---|---|
Resolution: | invalid |
Status: | closed → new |
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 , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Accepted → Ready for checkin |
I'm not sure -- you think we should document that something that differs from the actual signature?