Skip to content

Commit 062786a

Browse files
authored
Merge pull request #412 from groutr/faster_assoc
More efficient assoc
2 parents 68d8df8 + eb26030 commit 062786a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

toolz/dicttoolz.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,9 @@ def assoc(d, key, value, factory=dict):
192192
{'x': 1, 'y': 3}
193193
"""
194194
d2 = factory()
195+
d2.update(d)
195196
d2[key] = value
196-
return merge(d, d2, factory=factory)
197+
return d2
197198

198199

199200
def dissoc(d, *keys):

0 commit comments

Comments
 (0)