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 Patryk Zawadzki, 11 years ago

Owner: changed from nobody to Patryk Zawadzki
Status: newassigned

comment:2 by Anssi Kääriäinen, 11 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Marc Tamlyn, 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:4 by Patryk Zawadzki, 11 years ago

@mjtamlyn, can you provide a case that no longer works?

comment:5 by Tim Graham, 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 Aymeric Augustin, 11 years ago

Like Marc and Tim, I don't think the disruption caused by this change is really worth it.

comment:7 by Tim Graham, 11 years ago

Resolution: wontfix
Status: assignedclosed
Note: See TracTickets for help on using tickets.
Back to Top