-
Notifications
You must be signed in to change notification settings - Fork 378
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
Configuration parsing: "digits + underline" should be considered as a string #862
Comments
Hi @Jarvis73! 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:
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. |
Hi @thequilo! 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 |
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: