Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. def foo(x=[]):
  2. pass
  3.  
  4. foo.func_defaults
  5.  
  6. AttributeError: 'function' object has no attribute 'func_defaults'
  7.  
  8. def foo(x=[]):
  9. x.append(1)
  10.  
  11. foo()
  12. foo()
  13. print(foo.__defaults__)
  14. # ([1, 1],)
  15.  
  16. def foo():
  17. pass
  18.  
  19. print(foo.__defaults__)
  20. # None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement