Contribute Media
A thank you to everyone who makes this possible: Read More

Getting Rich with Comparison Methods

Description

Matt's obsession with Python's rich comparison methods started about 6 years ago with a gnarly bug and some bad assumptions. A few long nights and a lot of reading later, the docs corrected my assumption:

There are no implied relationships among the comparison operators. The truth of x==y does not imply that x!=y is false. Mind == blown and mind != blown. In Getting Rich with Comparison Methods we'll start by learning how to avoid common and costly bugs in your rich comparison methods, learn a bit about which methods are executed in comparisons and why, and then go beyond symmetrical comparisons exploring some of the ways we can take full advantage of asymmetrical comparison methods.

Details

Improve this page