On Sat, Jul 14, 2012 at 1:04 AM, Steven D'Aprano
<steve+comp.lang.pyt...@pearwood.info> wrote:
> Actually, no. Is True less than False, or is it greater? In boolean
> algebra, the question has no answer. It is only an implementation detail
> of Python that chooses False < True.

Maybe in boolean algebra, but in code, it's handy to have sortable
bools. In SQL, for instance, I can use a boolean in an ORDER BY,
perhaps followed by another criterion, and it's effectively sorting by
"1 if some_boolean else 0" or in C notation "some_boolean ? 0 : 1"

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to