Skip to content

Instantly share code, notes, and snippets.

@qiuyujx
Created May 2, 2022 12:43
Show Gist options
  • Save qiuyujx/a1942fecef8a554501a52aeb686f0719 to your computer and use it in GitHub Desktop.
Save qiuyujx/a1942fecef8a554501a52aeb686f0719 to your computer and use it in GitHub Desktop.
python_data_class_make_dataclass.py
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