Remove comment recommending tuples in settings docs
|Reported by:||Daniel Pope <dan@…>||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
In the documentation for 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.
Change History (5)
comment:1 Changed 6 years ago by dc
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:4 Changed 6 years ago by mtredinnick
- Resolution set to fixed
- Status changed from new to closed