]> sipb.mit.edu Git - ikiwiki.git/commitdiff
comment on a non-obvious function
authorchrysn <chrysn@web>
Tue, 20 Mar 2012 15:59:33 +0000 (11:59 -0400)
committeradmin <admin@branchable.com>
Tue, 20 Mar 2012 15:59:33 +0000 (11:59 -0400)
doc/todo/sort_parameter_for_map_plugin_and_directive/python_algorithms.py

index ccee8185d090316b83ddf783c5223ed70204fbe9..894c5212e0a773107261b9681d2c3f92a8ed57de 100644 (file)
@@ -35,6 +35,12 @@ def strategy_byparents(sequence):
     """
 
     def partindices(item):
     """
 
     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)
         return tuple(sequence.index(item.rsplit('/', i)[0]) for i in range(item.count('/'), -1, -1))
 
     return sorted(sequence, key=partindices)