Changes between Version 4 and Version 5 of SortedDict
- Timestamp:
- Jan 26, 2009, 10:53:52 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SortedDict
v4 v5 12 12 `value_for_index(index)`[[br]] 13 13 Returns the value of the item at the given zero-based index. 14 15 == Creating new SortedDict == 16 17 If you create new SortedDict using basic Python dict, SortedDict will not preserve key order. The reason is that SortedDict will receive (basic Python) unordered dictionary and therefore doesn't know about key order. 18 19 This does NOT work. 20 {{{ 21 d = SortedDict({ 22 'b': 1, 23 'a': 2, 24 'c': 3 25 }) 26 }}} 27 28 This works. SortedDict got keys in right order. 29 {{{ 30 d2 = SortedDict() 31 d2['b'] = 1 32 d2['a'] = 2 33 d2['c'] = 3 34 }}}