Last active
December 20, 2015 12:09
-
-
Save ncraike/6129004 to your computer and use it in GitHub Desktop.
Random snippet from OrderedDict discussion with @nathan_hoad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> 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