diff options
author | chrysn <chrysn@web> | 2012-03-20 11:59:33 -0400 |
---|---|---|
committer | admin <admin@branchable.com> | 2012-03-20 11:59:33 -0400 |
commit | c9d9769f8373f64e027f3e041fd16c412f76b19a (patch) | |
tree | 5674801cb24e9699df39f815ae9a1b0544e77253 /doc | |
parent | 442f49319bb7d2624aef4dbc2d590c0b54020ba0 (diff) | |
download | ikiwiki-c9d9769f8373f64e027f3e041fd16c412f76b19a.tar ikiwiki-c9d9769f8373f64e027f3e041fd16c412f76b19a.tar.gz |
comment on a non-obvious function
Diffstat (limited to 'doc')
-rw-r--r-- | doc/todo/sort_parameter_for_map_plugin_and_directive/python_algorithms.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/todo/sort_parameter_for_map_plugin_and_directive/python_algorithms.py b/doc/todo/sort_parameter_for_map_plugin_and_directive/python_algorithms.py index ccee8185d..894c5212e 100644 --- a/doc/todo/sort_parameter_for_map_plugin_and_directive/python_algorithms.py +++ b/doc/todo/sort_parameter_for_map_plugin_and_directive/python_algorithms.py @@ -35,6 +35,12 @@ def strategy_byparents(sequence): """ def partindices(item): + """Convert an entry a tuple of the indices of the entry's parts. + + >>> sequence = testsequence + >>> assert partindices("c/2/x") == (sequence.index("c"), sequence.index("c/2"), sequence.index("c/2/x")) + fnord + """ return tuple(sequence.index(item.rsplit('/', i)[0]) for i in range(item.count('/'), -1, -1)) return sorted(sequence, key=partindices) |