Skip to content

Instantly share code, notes, and snippets.

@jkoppel
Created February 9, 2018 04:26
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 jkoppel/867b006af652f655dc19ab5ddc266aba to your computer and use it in GitHub Desktop.
Save jkoppel/867b006af652f655dc19ab5ddc266aba to your computer and use it in GitHub Desktop.
def normalize_interval(a, b):
if a <= b: return (a, b)
else: return (a, a)
# good version
def intersect(oth):
return interval(normalize_interval(min(self.hi, oth,hi), max(self.low, oth.low)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment