Created
July 10, 2018 15:41
-
-
Save tal95shah/18ca87ff9d0245c60c14eb679fbae2ed to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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