Skip to content

Instantly share code, notes, and snippets.

@jag-k
Created January 23, 2018 18:16
Show Gist options
  • Select an option

  • Save jag-k/cf4357332c42f4fafee871da1a1e70b5 to your computer and use it in GitHub Desktop.

Select an option

Save jag-k/cf4357332c42f4fafee871da1a1e70b5 to your computer and use it in GitHub Desktop.
def full_copy(l):
return [full_copy(i) if type(i) is list else i for i in list(l)]
if __name__ == '__main__':
t1 = [1, [2], [[3]]]
t2 = full_copy(t1)
t2[1].append(0)
t1[2][0].append(5)
print(t1, t2, sep='\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment