Skip to content
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

data like 1e-3 loaded from yaml is with type str #46

Open
xwu4lab opened this issue Dec 4, 2020 · 1 comment
Open

data like 1e-3 loaded from yaml is with type str #46

xwu4lab opened this issue Dec 4, 2020 · 1 comment

Comments

@xwu4lab
Copy link

xwu4lab commented Dec 4, 2020

It seems the decode is not performed when the value is loaded from file (such as yaml), so that data like 1e-3 will be recognized as str instead of float.

@naokiyokoyama
Copy link

This is because of how PyYAML loads the file. Yacs only has visibility to the dictionary generated by PyYAML, at which point "1e-3" has already been decoded as a string.

The way to fix your issue is to write "1.0e3" instead; then PyYAML will decode it as a float!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants