On Thu, Nov 15, 2012 at 10:36 AM, Steven D'Aprano <steve at pearwood.info> wrote: > On 15/11/12 05:54, Mark Adam wrote: > >> Merging of two dicts is done with dict.update. How do you do it on >> initialization? This doesn't make sense. > > > Frequently. > > my_prefs = dict(default_prefs, setting=True, another_setting=False) > > > Notice that I'm not merging one dict into another, but merging two dicts > into a third. Side point: Wouldn't it be quite logical to support dict addition? >>> {"a":1}+{"b":2} Traceback (most recent call last): File "<pyshell#59>", line 1, in <module> {"a":1}+{"b":2} TypeError: unsupported operand type(s) for +: 'dict' and 'dict' It would make sense for this to result in {"a":1,"b":2}. ChrisA
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4