Timeline for Output the sign
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 26, 2016 at 2:37 | comment | added | Dennis |
@Pietu1998 But there's even __rand__ , and & is commutative...
|
|
Dec 26, 2016 at 2:35 | comment | added | PurkkaKoodari |
@Mego By the contract __cmp__ returns an integer and sign(cmp(a,b)) = -sign(cmp(b,a)) , so a __rcmp__ method would probably be slower than just negating the result from __cmp__ .
|
|
Dec 23, 2016 at 15:10 | comment | added | user45941 |
It's a bit surprising that __cmp__ is the one comparison operator that doesn't have a reflexive version. But, it was always unloved, so I guess it's not that surprising.
|
|
Dec 20, 2016 at 18:59 | comment | added | Dennis | @nyuszika7h Not quite. Trying to use it as a function raises a TypeError. | |
Dec 20, 2016 at 18:57 | comment | added | user344 |
You can do -(0).__cmp__ though.
|
|
Dec 20, 2016 at 8:32 | comment | added | Sp3000 |
Too bad you can't do (0).__rcmp__ ...
|
|
Dec 20, 2016 at 6:05 | comment | added | Dennis | Whoops. Sorry... | |
Dec 20, 2016 at 6:02 | comment | added | Jonathan Allan | Oh you ninja'd me. | |
Dec 20, 2016 at 5:59 | history | answered | Dennis | CC BY-SA 3.0 |