Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| <script type='text/javascript'> | |
| var refreshJqlHistoryPane = function() { | |
| var localHistory = localStorage.getItem('jqlHistory'); | |
| if(localHistory){ | |
| var history = JSON.parse(localHistory); | |
| var historyEntries = history.map(function(jql){ | |
| var display = jql; | |
| if(display.length > 25){ | |
| display = display.substr(0,22) + "..."; | |
| } | 
| david$ atlas-run | |
| ... | |
| ... Downloading the internet here (as maven does) | |
| ... | |
| david$ ls -la | |
| total 24 | |
| drwxr-xr-x 9 david staff 306 27 Sep 20:32 . | |
| drwxr-xr-x 7 david staff 238 27 Sep 19:36 .. | |
| drwxr-xr-x 11 david staff 374 27 Sep 20:37 .idea | 
| Python 2.7.2 (default, Jun 20 2012, 16:23:33) | |
| [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> from __future__ import braces | |
| File "<stdin>", line 1 | |
| SyntaxError: not a chance | 
| #!/usr/bin/python | |
| #Copyright (c) 2012 Kyle Harrigan | |
| # | |
| #Permission is hereby granted, free of charge, to any person obtaining a copy | |
| #of this software and associated documentation files (the "Software"), to deal | |
| #in the Software without restriction, including without limitation the rights | |
| #to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| #copies of the Software, and to permit persons to whom the Software is | |
| #furnished to do so, subject to the following conditions: | |
| # | 
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!