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
When parsing configurations (such as name=123_456), maybe the digits + underline should be considered as a string? Now the underline will be ignored and the remaining digits are treated as an integer.
Sacred treats the arguments of configuration values as python literals (and treats everything it can't handle as a string), and what you see is actually just the way that python interprets numbers. I actually like the idea to just treat everything as python literal because it seems intuitive (to me, at least). But, I agree that we can come up with weird things:
For python main.py with name=0xdeef, we get 57071 <class 'int'>
For python main.py with name=1j, we get a TypeError (because JSON apparently can't serialize complex numbers?)
For python main.py with name=1e-1, we get 0.1 <class 'float'>. Obvious, but I really wouldn't expect that when seeing name=1e-1
python main.py with name=['a'] we get [a] <class 'str'>, and
For python main.py with name=["'a'"], we get ['a'] <class 'sacred.config.custom_containers.ReadOnlyList'>
This list could probably go on for a while, and after writing it down, I start to feel that it is actually not that intuitive. But, this list also shows that if we start to have exceptions to the "treat it as a literal" rule, we'll end up with many of them.
Thanks for the detailed explanation. Now I can understand the design purpose, and maybe it is more reasonable, in spite that we have to use '"xxx"' in some cases.
When parsing configurations (such as
name=123_456
), maybe the digits + underline should be considered as a string? Now the underline will be ignored and the remaining digits are treated as an integer.Example (main.py):
python main.py
, we getabc <class 'str'>
.python main.py with name=123_456
, we get123456 <class 'int'>
, which is quite wired.A simple solution is to run the script with
python main.py with name='"123_456"'
, but the command is a little messy and not intuitive.The text was updated successfully, but these errors were encountered: