Make default not global : Function Default Argument : Function PYTHON examples


PYTHON examples » Function » Function Default Argument »

 

Make default not global


Make default not global

def f(x, y=None):
    if y is None: y = []
    y.append(x)
    return y

print f(23)                
                


           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Function
» Function Default Argument