You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IMO it woud be nice if that would accept at least other base Python types like int, float and bool and convert these automatically do a suitable representation (which is obvious, I guess, expect perhaps for bool , where one could go by 0/1 (guess that should be it) or True/False/etc.).
Stripping off \n and the likes wouldn't be needed for those types anyway.
Perhaps one could make it generic? Only if the value is an instance of str, try to .replace(...) in all other cases, make a str() out of it?
Maybe with an exception for bool if 0/1 shall be used.
Cheers,
Chris.
The text was updated successfully, but these errors were encountered:
The problem with accepting non-string values is that it is easy to create a footgun. Numbers are likely to change over the lifetime of a process, which will end up with encoding something like the controller temperature in your example into many different time series. Enforcing that only string values provides an option to correct any mistakes, and if they know what they are doing they can cast the number or other type into a string.
Hey.
Right now, when one feeds a
dict
into Info.info()that contains values that are not
str` one get's an exception, like:IMO it woud be nice if that would accept at least other base Python types like
int
,float
andbool
and convert these automatically do a suitable representation (which is obvious, I guess, expect perhaps forbool
, where one could go by0
/1
(guess that should be it) orTrue
/False
/etc.).Stripping off
\n
and the likes wouldn't be needed for those types anyway.Perhaps one could make it generic? Only if the value is an instance of
str
, try to.replace(...)
in all other cases, make astr()
out of it?Maybe with an exception for
bool
if0
/1
shall be used.Cheers,
Chris.
The text was updated successfully, but these errors were encountered: