Best Practices for Using Types #57
Replies: 5 comments
-
For reference(thx @ZhiyuanChen for his help): |
Beta Was this translation helpful? Give feedback.
-
Fro reference: |
Beta Was this translation helpful? Give feedback.
-
For this specified purpose, you can just use For other purposes, such as when the argument may be a string or a float, you can use |
Beta Was this translation helpful? Give feedback.
-
@aisk Thank you for your suggestions which help a lot! This is the first time I've seen the numeric tower! And I agree that the answer to this question depends on many factors. I think these "well-known abstractions" with some domain specific considerations maybe the right approach. I think the trade off maybe key point here: too many domain specific defined types(like Thank again for your help! |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Q1. Is it a good choice to wrap all the types with domain alias? For example, we have many machine learning models parameters which are
float
orint
, should we defineParameter = Union[int, float]
, orNumber = Union[int, float]
withParameter = Number
?Q2. If we have many self-defined types, how to manage them in a better way? Make every machine learning model has it's own domain types is good choice or not? For example, in Model-A, we have
Parameter = Union[int, float]
andUnion[int, float]
has another meaning in Model-B withValue = Union[int, float]
.Beta Was this translation helpful? Give feedback.
All reactions