On Mon, 4 Mar 2019 15:57:38 -0800
Guido van Rossum <gu...@python.org> wrote:
> 
> > Those two points make me uncomfortable with "+=" strictly behaving
> > like ".update()".
> 
> And yet that's how it works for lists. (Note that dict.update() still has
> capabilities beyond +=, since you can also invoke it with keyword args.)

Yeah, well.... I do think "+=" for lists was a mistake.  I *still* have
trouble remembering the exact difference between "list +=" and
"list.extend" (yes, there is one: one accepts more types than the
other... which one it is, and why, I never remember; and, of course,
there might be the obscure performance difference because of
CPython's execution details).

I should not have to remember whether I want to use "list +=" or
"list.extend" every time I need to extend a list.  There is a virtue to

"""There should be one-- and preferably only one --obvious way to do
it"""

and we shouldn't break it more than we already did.

Regards

Antoine.


_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to