Skip to content

Instantly share code, notes, and snippets.

@tugloo1
Created August 6, 2020 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tugloo1/3b811611664173e813b44d936f2ba569 to your computer and use it in GitHub Desktop.
Save tugloo1/3b811611664173e813b44d936f2ba569 to your computer and use it in GitHub Desktop.
class BloodPressureDataPoint(object):
def __init__(self, systole, diastole, hr):
self.systole = systole
self.diastole = diastole
self.hr = hr
print("finished initializing")
def __lt__(self, other):
print("running less than comparison")
return self.systole < other.systole
def __gt__(self, other):
print("running greater than comparison")
return self.systole > other.systole
first = BloodPressureDataPoint(121, 78, 80)
second = BloodPressureDataPoint(140, 90, 85)
print(first > second)
print(second < first)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment