Skip to content

Commit ff00223

Browse files
authored
simplified & fixed assoc for immutable mappings
1 parent 4137875 commit ff00223

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

unification/core.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from collections import OrderedDict, deque
22
from collections.abc import Generator, Iterator, Mapping, Set
3-
from copy import copy
43
from functools import partial
54
from operator import length_hint
65

@@ -16,10 +15,7 @@
1615
@dispatch(Mapping, object, object)
1716
def assoc(s, u, v):
1817
"""Add an entry to a `Mapping` and return it."""
19-
if hasattr(s, "copy"):
20-
s = s.copy()
21-
else:
22-
s = copy(s) # pragma: no cover
18+
s = dict(s)
2319
s[u] = v
2420
return s
2521

0 commit comments

Comments
 (0)