El vie, 5 ago 2022 a las 10:13, Buck Evan (<buck.2019@gmail.com>) escribió:
Shantanu Jain wrote:
> There's a better and more flexible way to accomplish this kind of lie
> already:
> ```
> if typing.TYPE_CHECKING:
>      mydataclass = dataclasses.dataclass
> else:
>     def mydataclass(...): ...
> ```

Would PEP681 exist if that were true?

Shantanu's solution works for simple cases where something works *exactly* like @dataclass. PEP 681 extends to more cases where a library provides broadly dataclass-like semantics, but e.g. using a metaclass instead of a decorator.