Hacker News new | ask | show | jobs
by rendall 1682 days ago
As not a Python programmer, I'm struggling to understand the issue.

Your (or blogger's) claim is that GitHub misparses the YAML actions config when it comes specifically to Python? Or that YAML is inherently inadequate to the task of representing Python's necessary actions?

1 comments

The Python 3.10 issue is this, in yaml:

  Python_versions:
  - 3.8
  - 3.9
Then we add the new version in our yaml file:

  Python_versions:
  - 3.8
  - 3.9
  - 3.10
But now we discover that 3.10 is parsed as a float, just like the other ones were. But the problem is that 3.10 becomes 3.1, the equivalent float value! With 3.9 we didn't notice this problem.

I'm not sure what the name for this problem is.

It's something like.. an unfaithful but unintentionally working representation. Until it doesn't work anymore. The solution in YAML is to quote the values so that they become strings as intended.

How is that different from other formats? Take JSON:

    {"python_versions": [3.8, 3.9, 3.10]}
This is a problem in any config language that doesn't enforce types, and jf it does enforce types, you should've used quotes already (like you really should've been before 3.10 was added to the list).

Similar problems also exist in many config formats with scientific notation (2e345) or hexadecimal notation (0x12345) or octal notation (012345, no that's not a decimal number in many programming languages and config formats!).

What commonly supported alternative would you suggest for this use case?

The difference from JSON is that in JSON, you always have to write "" to get strings.

In YAML you can just write blah and and it becomes a string. Except when it doesn't, when it matches some other type of value.

Sure, if you ignore what the YAML documentation actually says.
> I'm not sure what the name for this problem is.

Not reading the manual? Same thing would happen in JSON.

Sure it's annoying but all the YAML docs I've ever read state that unquoted numbers are ints/floats.