Skip to content

Instantly share code, notes, and snippets.

@mara004
Last active April 4, 2026 01:08
Show Gist options
  • Select an option

  • Save mara004/30cbff2aa14d246ebb507303f45d0cc9 to your computer and use it in GitHub Desktop.

Select an option

Save mara004/30cbff2aa14d246ebb507303f45d0cc9 to your computer and use it in GitHub Desktop.
Python `copy.deepcopy()` does not work as expected on types/functions
>>> class Test:
...     def a(self, first):
...             print(first)
... 
>>> import copy
>>> Test2 = copy.deepcopy(Test)
>>> Test2.a is Test.a
True
>>> copy.copy(Test.a) is Test.a
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment