Guest User

Untitled

a guest
Nov 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. >>> def test(a=[]):
  2. ... a.append('A')
  3. ... return a
  4. ...
  5. >>> import copy
  6. >>> z1= copy.copy(test.func_defaults)
  7. >>> z2= copy.deepcopy(test.func_defaults)
  8. >>> z1 == z2
  9. True
  10. >>> test()
  11. ['A']
  12. >>> z1 == z2
  13. False
  14. >>> z1
  15. (['A'],)
  16. >>> z2
  17. ([],)
Add Comment
Please, Sign In to add comment