[Python-Dev] Cleaning-up the new unittest API

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Nov 2 23:33:39 CET 2010


exarkun at twistedmatrix.com wrote:
> I can't help thinking that most of this confusion is caused by using < 
> for determining subsets. If < were not defined for sets and people had 
> to use "set.issubset" (which exists already), then sorting a list with 
> sets would raise an exception, a much more understandable failure mode 
> than getting back a list in arbitrary order.

Personally I think it was premature to throw out __cmp__.
What should have happened instead is for __cmp__ to be
augmented with a fourth outcome, "not equal but unordered".
Then operations such as sorting that require a total ordering
could use __cmp__ and complain if they get an unordered
result.
-- 
Greg


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /