#!/bin/env python # Default arguments # From: https://docs.python.org/3/tutorial/controlflow.html#defining-functions # NB: The default value is evaluated only once! def f(a, L=[]): L.append(a) return L print (f(1)) print (f(2)) # this will print # [1] # [1, 2]