[Chicago] Ode to <>

Martin Maney maney at two14.net
Fri Sep 1 17:19:37 CEST 2006

On Fri, Sep 01, 2006 at 09:21:56AM -0500, Brian Ray wrote:
> Maybe the == inside the method is being overwritten, as well. Or  
> maybe I have this all wrong.

Not exactly wrong, but you'll want to reviews section 3.3.1 of the
Python Reference Manual if you're going to play with redefining
operators.  Relevant to this specific usage:

__lt__(self, other)
__le__(self, other)
__eq__(self, other)
__ne__(self, other)
__gt__(self, other)
__ge__(self, other)
    New in version 2.1. These are the so-called `rich comparison''
    methods, and are called for comparison operators in preference
    to __cmp__()

Among the greater ironies of the computer age is the fact that
information is cheap and accessible, and so it is no longer very valuable.
What is valuable is what one does with it.
And human imagination cannot be mechanized. -- the New York Times

More information about the Chicago mailing list