Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] Rich comparison confusion

Guido van Rossumguido@digicool.com
Fri, 19 Jan 2001 11:00:30 -0500


> Yes, the "inverse" is confusing. Is what you mean the "reverse" ?> Like the other right-side operators __radd__, is it correct to> think of>>    __ge__  == __rle__>> if __rle__ was written in the same fashion like __radd__ ?> It looks semantically the same, although the reason for a> call might be different.Yes, it's semantically the same, and the reason for the call is thesame too ("the left argument doesn't support the operator so let's tryif the right one knows").> And if my above view is right, would it perhaps be less> confusing to use in fact __rle__ and __rlt__,> or woudl it be more confusing, since __rlt__ would also be> invoked left-to-right, implementing ">".I prefer 6 new operators over 12 any day.  I can see no valid reasonwhy someone would want to overload a>b different than b<a, whilethere are plenty of reasons why a+b and b+a should be different:e.g. string concatenation.--Guido van Rossum (home page:http://www.python.org/~guido/)


[8]ページ先頭

©2009-2025 Movatter.jp