overloading ==
drewpc at my-deja.com
drewpc at my-deja.com
Thu Feb 1 15:55:05 EST 2001
In article
<slrn97hinl.i2n.quinn at hork.ugcs.caltech.edu>,
quinn at hork.ugcs.caltech.edu (Quinn Dunkan)
wrote:
> On Wed, 31 Jan 2001 16:30:06 -0800, Amritansh
Raghav <amritansh at mobilian.com>
> wrote:
> >can it be done?
> >i looked at the operator documentation under
Python Runtime Services - but
> >didnt find anything to suggest it could be
done.
>
> Yes, define __cmp__ or __rcmp__. See 3.3.1 in
the language reference.
>
if you look at the release notes for Python 2.1,
they've also added the following functions:
Operation Method name
< __lt__
<= __le__
> __gt__
>= __ge__
== __eq__
!= __ne__
(http://www.amk.ca/python/2.1/index.html#SECTION000400000000000000000)
Sent via Deja.com
http://www.deja.com/
More information about the Python-list
mailing list