On 06/14/2013 10:49 AM, Steven D'Aprano wrote:
> Correct. In Python, all boolean expressions are duck-typed: they aren't 
> restricted to True and False, but to any "true-ish" and "false-ish" 
> value, or as the Javascript people call them, truthy and falsey values.
> <snip>
> There are a couple of anomalies -- the timestamp representing midnight is 
> falsey, because it is implemented as a zero number of seconds; also 
> exhausted iterators and generators ought to be considered falsey, since 
> they are empty, but because they don't know they are empty until called, 
> they are actually treated as truthy. But otherwise, the model is very 
> clean.

Good explanation! Definitely enlightened me.  Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to