Shlomo Zalman Rabinowitz

Results 22 comments of Shlomo Zalman Rabinowitz

I think you can do this with a `__post_init__` function edit: link https://jcristharif.com/msgspec/structs.html#post-init-processing

Can you use subclassing for this? For example: ```python import msgspec class User(msgspec.Struct): name: str is_active: bool = True class UserOmitDefaults(User, omit_defaults=True): pass user = User(name="Alice") print(msgspec.json.encode(user)) # b'{"name":"Alice","is_active":true}' user_omit_defaults...