MrSlippery icon

Mutable optional arguments in Python

MrSlippery | PRO | 05/05/16 12:32:17 PM UTC | 0 ⭐ | 265 👁️ | Never ⏰ | []
Python |

80 B

|

None

|

0 👍

/

0 👎

def f(i, result=[]):
    result.append(i)
    return result
 
print f(3)
print f(4)

Comments