#32280 closed Cleanup/optimization (duplicate)
Change all documentation examples using variable-length tuples into lists
Reported by: | Adam Johnson | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In many places in the documentation we have examples using varible-length tuples, for example ModelAdmin.fields
which takes any number of fields.
For all the reasons I wrote up in my post tuples versus lists I think it would be good to convert all such examples to lists. This would make the documentation more beginner-friendly and less prone to propagating these mistakes.
There's also a general guideline I saw (from Guido maybe?) that tuples are intended for fixed-length records where the position is part of the meaning - e.g. (x, y)
coordinates - and lists are for variable-length collections of homogenous-meaning items. So all our variable-length tuples would be better as lists under this guideline.
Closing as duplicate of #30947. I think it will be good to keep all related cleanups in a single ticket.