[Python-ideas] PEP: Dict addition and subtraction
Antoine Pitrou
solipsis at pitrou.net
Sat Mar 16 06:40:51 EDT 2019
On Sat, 16 Mar 2019 01:59:07 +1100
Steven D'Aprano <steve at pearwood.info> wrote:
> On Fri, Mar 15, 2019 at 12:25:22PM +0100, Antoine Pitrou wrote:
>
> > 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;
>
> Both accept arbitrary iterables, and the documentation suggests that
> they are the same:
>
> https://docs.python.org/3/library/stdtypes.html#mutable-sequence-types
>
> Perhaps you are thinking of the difference between list + list versus
> list += iterable?
Hmm, it looks like I misremembered indeed. Thanks for correcting this.
Regards
Antoine.
More information about the Python-ideas
mailing list