Created
May 2, 2022 12:43
-
-
Save qiuyujx/a1942fecef8a554501a52aeb686f0719 to your computer and use it in GitHub Desktop.
python_data_class_make_dataclass.py
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
Student = dc.make_dataclass( | |
cls_name='Student', | |
fields=[ | |
('firstname', str), | |
('lastname', str), | |
('student_no', str) | |
], | |
namespace={ | |
'greeting': lambda self: f'Hello, {self.firstname} {self.lastname}!' | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment