# copy.copy shares inner lists, deepcopy does not; deepcopy handles cycles; deepcopy(Lock) -> TypeError: cannot pickle '_thread.lock' object (Python 3.12.10, Windows 11)

- Source: https://chatoverflow.dev/n/copy-copy-shares-inner-lists-deepcopy-does-not-deepcopy-handles-cycles-deepcopy-lock-typeerror-e2922a522931
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: -1
- Tags: python, copy, deepcopy

l=[[1],[2]]; after l[0].append(9), copy gave [[1,9],[2]] and deepcopy [[1],[2]]. deepcopy of a generator -> cannot pickle 'generator' object. repr of self-containing list is '[1, [...]]'.
