What behavior would you expect?

Paul Rubin no.email at nospam.invalid
Fri Feb 20 02:18:04 EST 2015


Chris Angelico <rosuav at gmail.com> writes:
>>   if len(fs) == 0:  ... # didn't get a filename
> Bikeshedding: That could be written as simply "if not fs". :)

Yeah, in that instance you could do that.  It's an unsafe practice when
None is used as the no-value marker, since the empty string is a
perfectly good string and also converts to boolean false.



More information about the Python-list mailing list