Re: value "on"=True in pyyaml?
Andrey Somov <[email protected]> Tue, 1 Mar 2016 23:12:04 +0100
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <CALbkv0fvW3oGeWqx8ySbW=_s-ZH3J3=NbEZUYvukFJRNUF4sDw@mail.gmail.com> |
I am afraid it is far too late for 1.2 Why not to finish YAML 2.0 and make it a small subset of YAML 1.2 ? :-) (I have a list of other things to drop) Andrey Somov SnakeYAML On Tue, Mar 1, 2016 at 8:07 PM, Ingy dot Net <[email protected]> wrote: > This is an example of one of the biggest issues with the state of modern > day YAML. I'd bet no 2 implementations do the same thing wrt implicit > typing of plain scalars. > > I think we need to retire http://yaml.org/type/ > > It's an idea from over 10 years ago that was well meaning but turned out > poorly. People making new YAML frameworks still use this info. > > I am currently of the opinion that: > > - Plain scalars in block context should only implicitly type to > numbers, strings or null > - Only JSON numerics are typed to !!int or !!float > - Plain (unquoted) empty value is typed to !!null > - Everything else is typed to !!str > - Booleans should migrate to only supporting !!true and !!false > - Loaders using a default schema should support !true !false (and > !null) > - The plain values of true and false should become strings > - This might take a while to get everyone on board > - Plain scalars in flow context should behave same as JSON. > - Empty values are !!null > - We should ditch octal, binary etc as possible implicit typing of > numbers > - We should ditch the (22 of them!!) special plain values that become > boolean > - Only true and false. In flow context. Lowercase. > > We can still keep the tag:yaml.org,2002 types, but we need to get out of > the implicit grab bag business. It will be the death of YAML! > > --- > > Related to that, is the concept that every YAML loader loads YAML to > native objects under the direction of a "schema"; but currently that > "schema" is baked into the code implementing loader. > > If we had a schema language, then all loaders could load YAML according to > a textual (thus easily reasonable) guide. Schemas could even be written for > loaders that didn't yet support them (as part of their doc) so that people > would know what to expect from their baked in behavior. > > More importantly, schemas could be written for popular YAML uses like, > say, Ansible or TravisCI that need values loaded a particular way. These > schemas could even be made to implicitly type true/false/null scalars, for > backwards compat. > > > On Mon, Feb 29, 2016 at 7:41 AM, Oren Ben-Kiki <[email protected]> wrote: > >> This is old YAML 1.0/1.1 proposed schema behavior. It was deprecated (to >> maximize JSON compatibility among other reasons). >> >> On Mon, Feb 29, 2016 at 5:20 PM, <[email protected]> wrote: >> >>> Is this as expected? >>> >>> >>> kbriggs> cat yaml_on.py >>> >>> >>> import yaml >>> x=""" >>> 0: on >>> 1: ON >>> 2: 'ON' >>> """ >>> print yaml.load(x) >>> >>> >>> kbriggs> python yaml_on.py >>> {0: True, 1: True, 2: 'ON'} >>> >>> >>> >>> Keith >>> >>> >>> ------------------------------------------------------------------------------ >>> Site24x7 APM Insight: Get Deep Visibility into Application Performance >>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >>> Monitor end-to-end web transactions and take corrective actions now >>> Troubleshoot faster and improve end-user experience. Signup Now! >>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 >>> _______________________________________________ >>> Yaml-core mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/yaml-core >>> >>> >> >> >> ------------------------------------------------------------------------------ >> Site24x7 APM Insight: Get Deep Visibility into Application Performance >> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >> Monitor end-to-end web transactions and take corrective actions now >> Troubleshoot faster and improve end-user experience. Signup Now! >> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 >> _______________________________________________ >> Yaml-core mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/yaml-core >> >> > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > _______________________________________________ > Yaml-core mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/yaml-core > > ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 _______________________________________________ Yaml-core mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/yaml-core