Skip to content

Instantly share code, notes, and snippets.

@cassioeskelsen
Last active June 12, 2021 12:36
Show Gist options
  • Select an option

  • Save cassioeskelsen/244064c3376df57fa1b6345ff1758b43 to your computer and use it in GitHub Desktop.

Select an option

Save cassioeskelsen/244064c3376df57fa1b6345ff1758b43 to your computer and use it in GitHub Desktop.
from dataclasses import dataclass
@dataclass(eq=True)
class State:
name: str
Id: str = None # actually, state abbreviation
def __hash__(self) -> int:
return hash(self.Id)
@dataclass(eq=True, unsafe_hash=True)
class Address:
address: str
complement: str
zip_code: int
city: str
state: State
@dataclass(eq=True)
class Customer:
name: str
address: Address
document: str
Id: str = None
def __hash__(self) -> int:
return hash(self.Id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment