diff options
Diffstat (limited to 'mammoth/lists.py')
| -rw-r--r-- | mammoth/lists.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mammoth/lists.py b/mammoth/lists.py index db1f9ca..28468fe 100644 --- a/mammoth/lists.py +++ b/mammoth/lists.py @@ -23,6 +23,12 @@ def flat_map(func, values): ] +def find_index(predicate, values): + for index, value in enumerate(values): + if predicate(value): + return index + + if sys.version_info[0] == 2: map = map filter = filter |
