Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#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.

Change History (2)

comment:1 by Mariusz Felisiak, 4 years ago

Resolution: duplicate
Status: newclosed

Closing as duplicate of #30947. I think it will be good to keep all related cleanups in a single ticket.

comment:2 by Adam Johnson, 4 years ago

Thanks for knowing about/finding the dupe!

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