Last active
December 28, 2018 09:37
-
-
Save GreatBahram/e042bf08015fd7a973b523749cad903e to your computer and use it in GitHub Desktop.
Dataclass introduction @ virgool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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