Answers the boolean result how self compares to rendered u. >>> u = pt(20) >>> u > 19 True >>> u > 20 False >>> u > pt(19) # Compare with different unit instances of same class True >>> u > mm(2) # Compare with unit instance of differe
(self, u)
| 807 | return False |
| 808 | |
| 809 | def __gt__(self, u): |
| 810 | """Answers the boolean result how self compares to rendered u. |
| 811 | |
| 812 | >>> u = pt(20) |
| 813 | >>> u > 19 |
| 814 | True |
| 815 | >>> u > 20 |
| 816 | False |
| 817 | >>> u > pt(19) # Compare with different unit instances of same class |
| 818 | True |
| 819 | >>> u > mm(2) # Compare with unit instance of different class. |
| 820 | True |
| 821 | >>> u > mm(200) # Compare with unit instance of different class. |
| 822 | False |
| 823 | >>> u > [] # All other situations are not matching |
| 824 | False |
| 825 | """ |
| 826 | if isinstance(u, (int, float)): # One is a scalar, just compare |
| 827 | return self.rv > u |
| 828 | if isUnit(u): |
| 829 | if isinstance(u, self.__class__): |
| 830 | return self.rv > u.rv |
| 831 | return self.pt > u.pt # Incompatible unit types, compare via points |
| 832 | return False |
| 833 | |
| 834 | def __add__(self, u): |
| 835 | """Adds self to `u`, creating a new Unit instance with the same type |