Skip to content

Instantly share code, notes, and snippets.

@achalddave
Last active October 7, 2016 16:34
Show Gist options
  • Save achalddave/0c8acc998acb21b4372d02d0b0650b12 to your computer and use it in GitHub Desktop.
Save achalddave/0c8acc998acb21b4372d02d0b0650b12 to your computer and use it in GitHub Desktop.
lyaml library parses null in yaml as a string. See https://github.com/gvvaughan/lyaml/issues/13 for discussion
th> lyaml = require 'lyaml'
                                                                      [0.0016s]
th> out = lyaml.load('key: null')
                                                                      [0.0002s]
th> out.key
null
                                                                      [0.0000s]
th> type(out.key)
string

By comparison, python handles null correctly:

12:24:48 | trinity
~/scratch/lyaml/lyaml-release-v6.0 ~ ipy
WARNING: IPython History requires SQLite, your history will not be saved
Python 2.7.4 (default, Apr 19 2013, 14:18:01)
Type "copyright", "credits" or "license" for more information.

IPython 4.2.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import yaml

In [2]: out = yaml.load('key: null')

In [3]: out['key']

In [4]: out
Out[4]: {'key': None}

In [5]: type(out['key'])
Out[5]: NoneType
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment