[Tutor] Best way to define comparison
Tiago Katcipis
katcipis at inf.ufsc.br
Sat May 17 20:18:38 CEST 2008
Im writing a class on python and i want to implement the == and != operators
on it. I have read about __cmp__ and about __eq__ for == and __ne__ for ! =.
My question is... who is the better to use? and if there is no better what
are the advantages and disvantages of them. Some articles talk about using
cmp, and others about the eq...its a little confusing :-(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080517/10c526d5/attachment.htm>
More information about the Tutor
mailing list