Opened 11 years ago
Closed 11 years ago
#20466 closed Cleanup/optimization (wontfix)
Idiomatic Python: use lists instead of tuples where appropriate
Reported by: | Patryk Zawadzki | Owned by: | Patryk Zawadzki |
---|---|---|---|
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: | no | UI/UX: | no |
Description
Currently most of the documented lists are actually tuples. This is uncalled for and not really pythonic.
Python authors have already stated that tuple
was not a frozen list. Let's stick to using tuples where tuples fit, eg. where a namedtuple
could be used instead but would be an overkill.
Change History (7)
comment:1 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 11 years ago
I'm concerned about the backwards compatibility of this patch - I know in a number of my projects I import the default value from global settings and combine it with another list/tuple of my own appropriately. It's a minor issue, but I'm not sure it's worth breaking things for the sake of a little properness. Nothing is broken at the moment.
comment:5 by , 11 years ago
I had similar concerns. For example:
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS TEMPLATE_CONTEXT_PROCESSORS + ('myapp.myprocessor',)
After this change, the above code would throw an error: TypeError: can only concatenate list (not "tuple") to list
.
comment:6 by , 11 years ago
Like Marc and Tim, I don't think the disruption caused by this change is really worth it.
comment:7 by , 11 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
Pull request: https://github.com/django/django/pull/1177