checking if a list is empty
harrismh777
harrismh777 at charter.net
Wed May 11 18:38:58 EDT 2011
Steven D'Aprano wrote:
>> modelled. Lists do not have truth values in the application domain
> Yes they do. Empty lists are nothing, ergo false, and non-empty lists are
> something, ergo true.
>
No they don't. Empty lists are empty lists... which just happen to
become False when type cast bool(list[])--> False.
lists cannot have a truth... binary False or True... however, when cast
with bool(list) they can be used in a test (even with 'not') to make
some decision.
Lists by themselves, empty or not, cannot have a 'truth' in an of
themselves.
kind regards,
m harris
More information about the Python-list
mailing list