Skip to content

Instantly share code, notes, and snippets.

@GreatBahram
Last active December 28, 2018 09:37
Show Gist options
  • Save GreatBahram/e042bf08015fd7a973b523749cad903e to your computer and use it in GitHub Desktop.
Save GreatBahram/e042bf08015fd7a973b523749cad903e to your computer and use it in GitHub Desktop.
Dataclass introduction @ virgool
class Person:
def __init__(self, name, surname, age):
self.name = name
self.surname = surname
self.age = age
def __repr__(self):
return f'{self.__class__.__name__}: <{self.name} {self.surname}>'
def __eq__(self, other):
return (self.name, self.surname, self.age) == (other.name, other.surname, other.age)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment