why are these not the same?

Lowell Kirsh lkirsh at cs.ubc.ca
Thu Jan 20 04:28:34 EST 2005


On a webpage (see link below) I read that the following 2 forms are not 
the same and that the second should be avoided. They look the same to 
me. What's the difference?

Lowell

----

def functionF(argString="abc", argList = None):
         if argList is None: argList = []
         ...

def functionF(argString="abc", argList=None):
         argList = argList or []
         ...

http://www.ferg.org/projects/python_gotchas.html (number 5)



More information about the Python-list mailing list