From 24a93eaf6807c9ce10cc300301fee1d2c83e55d0 Mon Sep 17 00:00:00 2001 From: Bo Bayles Date: Sun, 21 May 2017 10:29:01 -0500 Subject: [PATCH] Really one more tweak for locate() docstring --- more_itertools/more.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/more_itertools/more.py b/more_itertools/more.py index 31d0b75a..f42a7b61 100644 --- a/more_itertools/more.py +++ b/more_itertools/more.py @@ -1308,13 +1308,13 @@ def locate(iterable, pred=bool): """Yield the index of each item in *iterable* for which *pred* returns ``True``. - *pred* defaults to ``bool``, which will select truthy items: + *pred* defaults to :func:`bool`, which will select truthy items: >>> list(locate([0, 1, 1, 0, 1, 0, 0])) [1, 2, 4] Set *pred* to a custom function to, e.g., find the indexes for a particular - item. + item: >>> list(locate(['a', 'b', 'c', 'b'], lambda x: x == 'b')) [1, 3]