Timeline for How do I merge two dictionaries in a single expression in Python?
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 3 at 17:18 | comment | added | thanos.a | In python 3.8.2 it gives me AttributeError: 'dict' object has no attribute 'iteritems' so I have changes the iteritems with items. | |
Nov 9, 2018 at 13:24 | comment | added | Jérôme | @AaronHall agreed this does not answer the question. But it answers my need. I understand those limitations, but that's not an issue in my case. Thinking of it, maybe the name is misleading, as it might evoke a deepcopy, which it does not provide. But it addresses deep nesting. Here's another implementation from the Martellibot: stackoverflow.com/questions/3232943/…. | |
Nov 9, 2018 at 2:14 | comment | added | Aaron Hall♦ | This does not answer the question. The question clearly asks for a new dictionary, z, from original dictionaries, x and y, with values from y replacing those of x - not an updated dictionary. This answer modifies y in-place by adding values from x. Worse, it does not copy these values, so one could further modify the modified dictionary, y, and modifications could be reflected in dictionary x. @Jérôme I hope this code is not causing any bugs for your application - at least consider using deepcopy to copy the values. | |
S Dec 18, 2015 at 11:19 | history | suggested | Dawid Gosławski | CC BY-SA 3.0 |
pylints C0113
|
Dec 18, 2015 at 10:42 | review | Suggested edits | |||
S Dec 18, 2015 at 11:19 | |||||
Oct 7, 2013 at 20:06 | history | edited | Stan | CC BY-SA 3.0 |
rewrote with rednaw's edits
|
Oct 7, 2013 at 10:43 | review | Suggested edits | |||
Oct 7, 2013 at 10:47 | |||||
Jul 10, 2012 at 20:34 | review | Low quality answers | |||
Jul 29, 2012 at 10:14 | |||||
Nov 29, 2011 at 11:52 | history | answered | Stan | CC BY-SA 3.0 |