-
Notifications
You must be signed in to change notification settings - Fork 518
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
y|Y|n|N not Recognised as Booleans #247
Comments
PR: #248 |
It's really unfortunate that the YAML spec has such an extensive list of values that decode as bool. The single char variants are pretty incredible. It forces this spelling: params:
x: 123
'y': 456 Without the quotes, the otherwise straight forward spelling of two common parameters has one of those turning up as a boolean. That's not just idiosyncratic, it's unusable. As a user-facing data-oriented spec I think that's broken. I was surprised that the PR above had not been merged but after this seeing this problem, I would count PyYAML's treatment of single char spellings of bools as a feature and not a bug. It's unfortunate that the spec goes this far as it presents a nasty trade off between usability and cross system compatibility -- the primary goals of YAML. |
According to https://yaml.org/type/bool.html,
y
,Y
.n
, andN
are Boolean scalars.PyYAML, however, does not recognise them as such, and parses them as strings.
Example:
The text was updated successfully, but these errors were encountered: