Skip to content

Instantly share code, notes, and snippets.

@ncraike
Last active December 20, 2015 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ncraike/6129004 to your computer and use it in GitHub Desktop.
Save ncraike/6129004 to your computer and use it in GitHub Desktop.
Random snippet from OrderedDict discussion with @nathan_hoad
>>> od
OrderedDict([('my first key', 'first val'), ('second', 'something'), ('third', 'blah')])
>>> od._OrderedDict__root[0]
[[[[[...], [...], None], [...], 'my first key'], [...], 'second'], [[...], [[...], [[...], [...], 'second'], 'my first key'], None], 'third']
>>> od._OrderedDict__root[1]
[[[[[...], [...], 'second'], [...], 'third'], [...], None], [[...], [[...], [[...], [...], None], 'third'], 'second'], 'my first key']
>>>
>>> from pprint import pprint as pp
>>> pp(od._OrderedDict__root)
[[[[<Recursion on list with id=24188808>,
<Recursion on list with id=24182616>,
'my first key'],
<Recursion on list with id=23548992>,
'second'],
<Recursion on list with id=24188808>,
'third'],
[<Recursion on list with id=24188808>,
[<Recursion on list with id=24189048>,
[<Recursion on list with id=24182616>,
<Recursion on list with id=24188808>,
'third'],
'second'],
'my first key'],
None]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment