MrSlippery

Mutable optional arguments in Python

May 5th, 2016
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.08 KB | None | 0 0
  1. def f(i, result=[]):
  2.     result.append(i)
  3.     return result
  4.  
  5. print f(3)
  6. print f(4)
Advertisement
Add Comment
Please, Sign In to add comment