Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def foo(x=[]):
- pass
- foo.func_defaults
- AttributeError: 'function' object has no attribute 'func_defaults'
- def foo(x=[]):
- x.append(1)
- foo()
- foo()
- print(foo.__defaults__)
- # ([1, 1],)
- def foo():
- pass
- print(foo.__defaults__)
- # None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement