-
Notifications
You must be signed in to change notification settings - Fork 5
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
Investigate some simple typing for rates #19
Comments
@knikolla I think adding data types in order to permit data validation is an excellent idea. I wonder about this:
If the data type is encoded in the data, why do we need a
I would vote for data type violations to be a hard error now. |
I considered omitting that, but I wanted to force the client to explicitly specify the expected datatype, to work around Python's dynamic typing. Similar to an Ultimately, I don't feel strongly about this.
I want to give enough time for the downstream scripts that use |
Another alternative approach is having separate |
@knikolla I am fine with either implementing a |
We now have a mix of bools, strings, and numbers.
It is easy to forget to convert the value received from the library to the appropriate type, and that means it's time to consider enforcing some typing for at least string, bools and numbers.
Proposal
type
.type
can be of valuestr, bool, Decimal
and corresponds to the Python name of the Datatype.get_value_at(name, month)
is extended toget_value(name, month, datatype=None)
get_value_at(name, month, datatype=None)
is provided, the return string is converted to the requested datatype, provided the datatype matches thetype
defined in the rate.type
,get_value_at()
requires also providing the appropriate datatype class otherwise it spews a warning. For now, we can turn this into a hard error later.The text was updated successfully, but these errors were encountered: