tickets: 8846
This data as json
id | created | changetime | last_pulled_from_trac | stage | status | component | type | severity | version | resolution | summary | description | owner | reporter | keywords | easy | has_patch | needs_better_patch | needs_tests | needs_docs | ui_ux |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8846 | 2008-09-03 15:23:37 | 2008-10-05 09:00:08 | 2022-03-06 03:43:19.176022 | Unreviewed | closed | Documentation | dev | fixed | Remove comment recommending tuples in settings docs | In the documentation for [http://docs.djangoproject.com/en/dev/topics/settings/#creating-your-own-settings Creating your own settings] there's a recommendation which reads "For settings that are sequences, use tuples instead of lists. This is purely for performance." This is bunk. Profiling shows that tuples run no faster than lists for most operations (certainly looping, which we are likely to do most often). On the other hand, list-literal syntax has the advantage that it doesn't collapse to a single value when you have a single item and omit the trailing comma, like tuple syntax. Using list syntax is no slower, more legible and less error prone. An often-expressed view in the wider Python community seems that tuples should not be considered as immutable lists. They are intended as fixed-length records - indeed the mathematical concept of a tuple is quite distinct from that of a sequence. I suggest this (factually inaccurate) comment be removed, and in fact we should look at migrating all of the settings documentation to lists for legibility. | nobody | Daniel Pope <dan@mauveinternet.co.uk> | 0 | 0 | 0 | 0 | 0 | 0 |