[Django] #32280: Change all documentation examples using variable-length tuples into lists

12 views
Skip to first unread message

Django

unread,
Dec 17, 2020, 5:38:56 AM12/17/20
to django-...@googlegroups.com
#32280: Change all documentation examples using variable-length tuples into lists
-------------------------------------------------+------------------------
Reporter: Adam (Chainz) Johnson | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------------+------------------------
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
[https://adamj.eu/tech/2019/07/05/tuples-versus-lists-in-python/ 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/32280>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 17, 2020, 6:03:00 AM12/17/20
to django-...@googlegroups.com
#32280: Change all documentation examples using variable-length tuples into lists
-------------------------------------+-------------------------------------
Reporter: Adam Johnson | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => duplicate


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/32280#comment:1>

Django

unread,
Dec 17, 2020, 8:40:02 AM12/17/20
to django-...@googlegroups.com
#32280: Change all documentation examples using variable-length tuples into lists
-------------------------------------+-------------------------------------
Reporter: Adam Johnson | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Adam Johnson):

Thanks for knowing about/finding the dupe!

--
Ticket URL: <https://code.djangoproject.com/ticket/32280#comment:2>

Reply all
Reply to author
Forward
0 new messages