Skip to content

Commit

Permalink
bug fix: properly clone tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Feb 16, 2024
1 parent f34809a commit 30171f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lenskit/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ def clone(algo):

sps = dict([(k, clone(v)) for (k, v) in params.items()])
return algo.__class__(**sps)
elif isinstance(algo, list) or isinstance(algo, tuple):
elif isinstance(algo, list):
return [clone(a) for a in algo]
elif isinstance(algo, tuple):
return tuple(clone(a) for a in algo)
else:
return deepcopy(algo)

Expand Down

0 comments on commit 30171f0

Please sign in to comment.