why are these not the same?
lkirsh at cs.ubc.ca
Thu Jan 20 04:48:41 EST 2005
D'oh I should've caught that myself.
Fredrik Lundh wrote:
> Lowell Kirsh wrote:
>>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?
>>def functionF(argString="abc", argList = None):
>> if argList is None: argList = 
>>def functionF(argString="abc", argList=None):
>> argList = argList or 
> "is None" tests for None, "argList or" tests for a false value. None is
> false, but many non-None objects are also false.
> "should be avoided" sounds like overly zealous advice to me; use the
> latter form if you understand it.
More information about the Python-list