This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author BrenBarn
Recipients BrenBarn, ashwch, benrg, docs@python, ezio.melotti, r.david.murray, rhettinger, terry.reedy
Date 2015-09-18.17:32:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442597559.55.0.0510389405166.issue16701@psf.upfronthosting.co.za>
In-reply-to
Content
This needs to be fixed.  The documentation for the behavior of +=  on lists needs to be with the documentation on lists.  The existing, vague documentation that += works in-place "when possible" is insufficient.

A central feature of Python is that the behavior of operators like + and += is overridable on a per-type basis.  Hence, the Language Reference is not the appropriate place for describing the behavior of += on a particular type.  The behavior of += on lists should be documented where the behavior of lists is documented (as, for instance, the behavior of + on lists already is), not where the syntax of += is documented.

Someone just asked a question on StackOverflow about this (http://stackoverflow.com/questions/32657637/python-changing-variables-vs-arrays-in-functions/32657770#32657770).  It is embarrassing to have to tell people, "To know what += does on a type, you need to look at the documentation for that type. . . except that the documentation for the builtin types doesn't document what some operators do."
History
Date User Action Args
2015-09-18 17:32:39BrenBarnsetrecipients: + BrenBarn, rhettinger, terry.reedy, ezio.melotti, r.david.murray, docs@python, benrg, ashwch
2015-09-18 17:32:39BrenBarnsetmessageid: <1442597559.55.0.0510389405166.issue16701@psf.upfronthosting.co.za>
2015-09-18 17:32:39BrenBarnlinkissue16701 messages
2015-09-18 17:32:39BrenBarncreate