attrs
attrs copied to clipboard
Pass kwargs to __attrs_pre_init__()
This issue was closed but the args are passed in as positional arguments which isn't very helpful for my use case where there are a lot of fields and I only want to update one of them.
Can we also add support for passing in kwargs? Example:
def __attrs_pre_init__(self, **kwargs):
...
super().__init__(**kwargs)
...
Glancing at the code, ISTM that __attrs_pre_init__ is called the same way at __init__ so shouldn't:
def __attrs_pre_init__(self, *_, **kwargs):
...
super().__init__(**kwargs)
...
just work? That presumes that all your arguments are kw-only, tho. If you're asking attrs to convert posargs into kwargs for this one call, I'm afraid that's out of scope.