Closed felixhekhorn closed 2 years ago
In [1]: import yaml
In [2]: aaa = """
...: test: yes
...: more: "no"
...: pepe: "yes"
...: unq: no
...: """
In [3]: yaml.safe_load(aaa)
Out[3]: {'test': True, 'more': 'no', 'pepe': 'yes', 'unq': False}
Apparently yaml.safe_load
needs quotes for yes/no, but I will fix the spelling
Indeed: yes
, no
, true
, false
are special strings
no
in particular it is known as the Norway problem
Ah, the famous nordic countries: Denmark, Finland, Iceland, Sweden and False
But actually @scarlehoff, why are you using the yes
and no
strings, instead of booleans?
The vrap gods decided so.
But is it worth to propagate it to our runcards?
I'd rather propose to do the translation from booleans to vrap values (i.e. yes
and no
), and keep our runcards more meaningful...
But is it worth to propagate it to our runcards?
Yes, because one of the requests for the runcards was that they were almost vrap
runcards (and they are, just removing the :
they become vrap
runcards). If there were more complicated translations going on already I would agree but as they stand right now I prefer to use the vrap
literals.
Ok, I agree.
Let's just keep in mind for later then. If ever we'll improve the runcard structure, we'll switch to booleans.
Since @AleCandido pointed out to me, I became aware of other people doing the same: double quotes in yaml are not needed for strings and can be surpressed: https://github.com/NNPDF/runcards/blob/a33eb132be6b1f0a31209281cef93fccedf9db11/pinecards/DYE605/vrap.yaml#L17-L18
(as a plus, if you want, choose a spelling for yes/no - actually vrap is agnostic on that)