Closed slavfox closed 2 years ago
I'm not sure __match_args__
is the best way to handle this. The positional placement of these parameters are unintuitive compared to other examples. Undefined
should definitely not have __match_args__
, and type
should probably not be part of __match_args__
even when it's needed to tell events apart.
I'd rather update the docs to use keywords.
The previous documentation was from a misunderstanding. For now I've updated the docs to use keywords in all cases. I'd be willing to discuss about __match_args__
but I think there's too much variation in the event parameters for positional binding to be a good idea.
See PEP-0622. Adds
__match_args__
to allEvent
subclasses mirroring their initializers to allow for positional pattern matching - the example from docs:Doesn't work without
__match_args__
since only namedtuples and dataclasses support positional pattern matching out of the box.