generated from simonw/python-lib-template-repository
-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
I added this case statement in my context
to proceed:
case _ if is_dataclass(value):
# This is an instance of a dataclass, call __call__ and return
return result()
If you'd like, I can make a branch with some tests and a proposed implementation. We don't have to force dataclasses, we can do regular classes.
We can also move the condition outside of the match. For example, when making result
, do a second test like this:
# Is result a callable?
if callable(result):
result = result()
...though this might open the door to false positives.
Metadata
Metadata
Assignees
Labels
No labels