On 05.06.13 09:53, Andrew Barnert wrote:
From: Stefan Drees ... Sent: Wednesday, June 5, 2013 12:31 AM ...
while some text of my previous reply to this mail (which is already in the archives, but has not yet reached my mailbox again) may be interesting read and the YAML spec might really profit from some rewriting to clarify the JSON-YAML relation, I overlooked "production 53" in [1] and the notion of what YAML uses a superset of C escape sequences realy means =(
Perfect timing; right after I hit "send", I see your followup… That'svery different. Never mind. :)
mistakes are so effficient in getting attention ;-)
Still, despite your mistake, your raised the point that the version of YAML implemented by PyYAML (YAML 1.1) is not a strict superset of JSON, and that may be worth addressing. Would PyYAML have to upgrade to 1.2, or at least to 1.1 plus enough 1.2 changes to make it a strict superset of JSON, to be worth adding to the stdlib? Or would it be reasonable to say "Don't use the yaml module to parse JSON, dummy"?
Someone (I think the OP of the cited pyyaml issue #11) noted, that they receive a mix of JSON and YAML messages over some interface and tried to handle that by simply digesting through a YAML parser. In the light of the wide deployment of YAML v1.1 in tools I would at least for some time resort to your latter alternative, maybe checking the last word against some applicable CoC ;-) But, I will mainly think a bit or two more about what the price for this JSONesque attitude actually is. If you're so inclined, please repeat after me: "You can't simply delegate processing of a double quoted JSON string to C functions expecting C escape sequences" (and it is not only production 53 ...) I am all for a YAML parser inside python stdlib - at some time - with clear expectations on conformance, performance and "expectation management" for the users thereof. The latter because I am convinced, that as soon as something is part of the stdlib, people will start using it to also "learn" from it's API and "terms" about the domain handled. So terms, API and error messages should all be conforming to YAML spec Version 1.2+errata and well "settled". Glossary (for dummies like me :) CoC: Code of Conduct. All the best, Stefan.