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]