FWIW, `typing.NamedTuple` did this in Python 3.5, three years before dataclasses was introduced in 3.7.
class Foo(typing.NamedTuple): a: int b: str f = Foo(a=1, b="hello") print(f.b) # "hello"
Foo = typing.NamedTuple('Foo', [('a', int), ('b', str)])
FWIW, `typing.NamedTuple` did this in Python 3.5, three years before dataclasses was introduced in 3.7.