python-betterproto icon indicating copy to clipboard operation
python-betterproto copied to clipboard

Simplify the generated code by explicitly removing dataclasses decorator

Open Gobot1234 opened this issue 3 years ago • 2 comments

If PEP 681 is accepted we would be able to simplify the generated code by removing the dataclasses decorator and then implictly make betterproto.Messages be dataclasses by defining __init_subclass__ and retain the typed constructor:

def __init_subclass__(cls) -> None:
    dataclasses.dataclass(eq=False, repr=False)(cls)

I think this would be a nice readabilty improvement.

Gobot1234 avatar Feb 03 '22 11:02 Gobot1234

Small update https://mail.python.org/archives/list/[email protected]/thread/JWMSWJ6JZJNNG3JKPBYDMQUUHZFD2FZL, this will probably have to wait for b6

Gobot1234 avatar Apr 23 '22 11:04 Gobot1234

PEP 681 has now been accepted so this should be ok to implement

Gobot1234 avatar Jun 06 '22 15:06 Gobot1234