Closed mbraakhekke closed 2 years ago
The following example raises a TypeError when using dataclassy.dataclass, while it works fine with dataclasses.dataclass.
dataclassy.dataclass
dataclasses.dataclass
from dataclassy import dataclass from dataclasses import InitVar from typing import Any @dataclass class Foo: initvar: InitVar[Any] def __post_init__(self, initvar): pass foo = Foo(initvar = "foo") # TypeError: Foo.__post_init__() missing 1 required positional argument: 'initvar'
OK, I see now in the documentation that init-only variables are handled in a different way from dataclasses.
dataclasses
The following example raises a TypeError when using
dataclassy.dataclass
, while it works fine withdataclasses.dataclass
.