Skip to content

Instantly share code, notes, and snippets.

@MartinThoma
Created March 3, 2021 21:55
Show Gist options
  • Select an option

  • Save MartinThoma/b01ca0871e5a0eadfb0bb6ea6b351481 to your computer and use it in GitHub Desktop.

Select an option

Save MartinThoma/b01ca0871e5a0eadfb0bb6ea6b351481 to your computer and use it in GitHub Desktop.
def __post_init__(self):
if not (-180 <= self.longitude <= 180):
v = self.longitude
raise ValueError(f"Longitude was {v}, but must be in [-180, +180]")
if not (-90 <= self.latitude <= 90):
v = self.latitude
raise ValueError(f"Latitude was {v}, but must be in [-90, +90]")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment