17 May 21:30
Re: Best way to define comparison
From: bob gailer <bgailer <at> gmail.com>
Subject: Re: Best way to define comparison
Newsgroups: gmane.comp.python.tutor
Date: 2008-05-17 19:30:46 GMT
Subject: Re: Best way to define comparison
Newsgroups: gmane.comp.python.tutor
Date: 2008-05-17 19:30:46 GMT
Tiago Katcipis wrote: > 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 confusingAFAIK either approach is OK. No advantages. (Other than writing one method vs 2). -- -- Bob Gailer 919-636-4239 Chapel Hill, NC _______________________________________________ Tutor maillist - Tutor <at> python.org http://mail.python.org/mailman/listinfo/tutor
AFAIK either approach is OK. No advantages. (Other than writing one
method vs 2).
RSS Feed