-
Notifications
You must be signed in to change notification settings - Fork 4
X cash refac #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
X cash refac #60
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats the difference between CostData | MaxCostData?
because form the class its the same
class MaxCostData(CostData):
pass
so why this match?
case MaxCostData() as cost:
return cost.dict()
case CostData() as cost:
because its a different class it matches different?
CURRENCY = cast(CurrencyUnit, os.environ.get("CURRENCY", "sat"))
not 100% sure but i think cast is not type validation but just overriding the type for type checking so mybe better Pydantic validation?
or cast just to get rid of the typing error
it is basically a type check to move value check consern to different level, so the function where the classes are used, will not have to care about checking values to decide when and what to return ... |
not realy validating in that case, I'm not sure if we need to validate (we could) .. just making sure that the user, that uses the redeem function knows what to expect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
No description provided.