Skip to content

Instantly share code, notes, and snippets.

@tal95shah
Created July 10, 2018 15:41
Show Gist options
  • Select an option

  • Save tal95shah/18ca87ff9d0245c60c14eb679fbae2ed to your computer and use it in GitHub Desktop.

Select an option

Save tal95shah/18ca87ff9d0245c60c14eb679fbae2ed to your computer and use it in GitHub Desktop.
from dataclasses import dataclass
@dataclass
class Employee(object):
id: int
name: str
if __name__ == '__main__':
emp = Employee(1,"Talha Gillani")
emp2= Employee(100,"Syed Talha Gillani")
print("emp:{}".format(emp))
emp.id = 100
print("emp:{}".format(emp))
print("emp2:{}".format(emp2))
print("emp == emp2:{}".format(emp == emp2))
print("emp != emp2:{}".format(emp != emp2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment