Operator Precedence/Boolean Logic
Marko Rauhamaa
marko at pacujo.net
Sat Jun 25 04:56:38 EDT 2016
Steven D'Aprano <steve at pearwood.info>:
> So we have falsey values:
>
> - None
> - zeroes (0, 0.0, 0j, etc)
> - empty dict {}
> - empty sets and frozensets
> - empty strings '' and b'' (in Python 2: u'' and '')
> - empty lists, tuples and other sequences
>
> and truthy values:
>
> - object
> - non-zero numbers
> - non-empty dicts
> - non-empty sets and frozensets
> - non-empty strings
> - non-empty sequences
It might be more descriptive to call those polar opposites "naughty" and
"nice." Or maybe "hollow" and "puffy."
Marko
More information about the Python-list
mailing list