[Python-ideas] Allow using ** twice
Nick Coghlan
ncoghlan at gmail.com
Fri Jun 7 00:38:48 CEST 2013
> If you wanted to do that you'd use a Counter:
>
> >>> from collections import Counter
> >>> dict1 = Counter()
> >>> dict2 = Counter()
>
> >>> dict1["arg1"] = 5
> >>> dict2["arg1"] = 3
> >>> dict1 + dict2
> Counter({'arg1': 8})
>
> As for dicts, -1.
*If* anything were to change for dicts, it would be to change or add
methods (such as a new alternative constructor) rather than add operator
support.
Cheers,
Nick.
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130607/5667291b/attachment.html>
More information about the Python-ideas
mailing list