Brendan Barnwell added the comment:

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

----------
nosy: +BrenBarn

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16701>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to