Opened 11 years ago

Closed 11 years ago

#7020 closed (wontfix)

Convert read-only global lists to tuples

Reported by: Piotr Lewandowski <django@…> Owned by: nobody
Component: Core (Other) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


According to DjangoSpecifications/Core/Threading - there are some global lists which rather should be converted to tuples:

As a matter of style, the read-only ones should really be tuples, not lists -- the 'say what you mean' idiom: if it shouldn't be modified, don't let it be by making it a tuple.

I've attached a patch that eliminates all read-only lists. Please notice that:

  • BLANK_CHOICE_DASH and BLANK_CHOICE_NONE are no longer single tuple wrapped in a list -- this change is slightly backwards-incompatible.
  • After commiting this patch DjangoSpecifications/Core/Threading (section Global lists) should be updated.

Attachments (1)

lists-to-tuples.diff (4.3 KB) - added by Piotr Lewandowski <django@…> 11 years ago.

Download all attachments as: .zip

Change History (2)

Changed 11 years ago by Piotr Lewandowski <django@…>

Attachment: lists-to-tuples.diff added

comment:1 Changed 11 years ago by Malcolm Tredinnick

Resolution: wontfix
Status: newclosed

The wiki page you reference is in no way official Django policy or anything like that. It is written by one person to describe what they would like to see happen. Fortunately, the page does reference James Tabuer's blog post about homogeneous vs heterogeneous data structures, which, whilst I don't agree with it entirely, is quite a reasonable argument and a common data pattern in Python code.

Thus, this isn't worth changing. Python isn't C++. A lot of things are done by convention rather than enforced with a shotgun in the living room. This is one of those cases. Not harmful, not inhibitive to writing good code, not worth changing.

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