[Tutor] True and 1 [was Re: use of the newer dict types]

Steven D'Aprano steve at pearwood.info
Sun Jul 28 06:04:30 CEST 2013


On 28/07/13 09:53, Alan Gauld wrote:

> Its not that false propagates out, it's how Python does a comparison of lists. The rules for equality are what matter here not the rules of boolean conversion.
>
> comparison operations return -1, 0 or 1.

You're thinking of the cmp() builtin (Python 2.x only, not 3.x). General comparison operations such as == < <= is etc. return True or False.

Comparison operators haven't depended on cmp() for a long time. You can google "rich comparison operators" for more info:

https://duckduckgo.com/?q=rich%20comparison%20operators


-- 
Steven


More information about the Tutor mailing list