schlichtanders.mylists module¶
Like mygenerators, there specific often needed utilities for lists. I really like the as_list decorator for
an empty args generator. Also, take a look at DictList.
-
class
schlichtanders.mylists.DictList(*list_entries, **names_to_list_of_list_entries)[source]¶ Bases:
_abcoll.MutableSequencefirstly, this is a list secondly, this is a dict pointing to lists of elements in DictList (kept unique, i.e. automatically removing duplicates)
-
schlichtanders.mylists.as_list(gen)[source]¶ generator decorator which executes the generator and returns results as list
-
schlichtanders.mylists.deflatten(flat_li, *original_li)[source]¶ rebuilds elements of flat_li to match list structure of original_li (or tuple if given as *args)
Parameters: - flat_li –
- original_li –
Returns: Return type: flat_li with nesting like original_li
-
schlichtanders.mylists.findall(l, o)[source]¶ find all indices from list
lwhere entries match specific objectoParameters: - l – list to search in
- o – object to search for
Returns: list of indices where l[i] == o