diff --git a/docs/colls.rst b/docs/colls.rst index 1bf0eff..a0119a4 100644 --- a/docs/colls.rst +++ b/docs/colls.rst @@ -174,11 +174,14 @@ Dict utils .. function:: omit(mapping, keys) - Returns a copy of ``mapping`` with ``keys`` omitted. Preserves collection type:: + Returns a copy of ``mapping`` with ``keys`` omitted. Each key of `mapping` is checked if it is contained with `keys`, so a string and an array could be used. Preserves collection type:: omit({'a': 1, 'b': 2, 'c': 3}, 'ac') # -> {'b': 2} + omit({'a': 1, 'b': 2, 'c': 3}, ['a', 'c']) + # -> {'b': 2} + .. function:: zip_values(*dicts) @@ -281,6 +284,11 @@ Data manipulation map(operator.itemgetter(key), mappings) + e.g. extracting a key from a list of dictionaries:: + + lpluck('name', [{'name': 'John'}, {'name': 'Mary'}]) + # -> ['John', 'Mary'] + .. function:: pluck_attr(attr, objects) lpluck_attr(attr, objects)