MCPcopy Create free account
hub / github.com/PageBot/PageBot / __lt__

Method __lt__

Lib/pagebot/toolbox/units.py:759–782  ·  view source on GitHub ↗

Answers the boolean result how self compares to rendered u. >>> u = pt(20) >>> u < 21 True >>> u < 20 False >>> u < pt(21) # Compare with different unit instances of same class True >>> u < mm(20) # Compare with unit instance of differ

(self, u)

Source from the content-addressed store, hash-verified

757 return False
758
759 def __lt__(self, u):
760 """Answers the boolean result how self compares to rendered u.
761
762 >>> u = pt(20)
763 >>> u < 21
764 True
765 >>> u < 20
766 False
767 >>> u < pt(21) # Compare with different unit instances of same class
768 True
769 >>> u < mm(20) # Compare with unit instance of different class.
770 True
771 >>> u < mm(2) # Compare with unit instance of different class.
772 False
773 >>> u < [] # All other situations are not matching
774 False
775 """
776 if isinstance(u, (int, float)): # One is a scalar, just compare
777 return self.rv < u
778 if isUnit(u):
779 if isinstance(u, self.__class__):
780 return self.rv < u.rv
781 return self.pt < u.pt # Incompatible unit types, compare via points
782 return False
783
784 def __ge__(self, u):
785 """Answers the boolean result how self compares to rendered u.

Callers

nothing calls this directly

Calls 1

isUnitFunction · 0.85

Tested by

no test coverage detected