Skip to content

zawan-ila/meta-dataclasses

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

meta-dataclasses

A minimal implementation of a dataclass metaclass. Inspired from dataklasses

Usage

from meta_dataclass import dataclass
class Name(metaclass=dataclass):
    first: str
    last: str

Name will automagically get reasonable definitions of the __init__, __repr__, __eq__, __iter__ and __hash__ methods.

>>> don = Name("Donald", "Knuth")
>>> don.first
'Donald'
>>> don
Name(first='Donald', last='Knuth')
>>> don == Name('Donald', 'Knuth')
True

About

Dataclasses with Metaclasses

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages