aboutsummaryrefslogtreecommitdiff
path: root/discord/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'discord/utils.py')
-rw-r--r--discord/utils.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/discord/utils.py b/discord/utils.py
index 9e230262..1629a454 100644
--- a/discord/utils.py
+++ b/discord/utils.py
@@ -58,15 +58,20 @@ def find(predicate, seq):
member = find(lambda m: m.name == 'Mighty', channel.server.members)
would find the first :class:`Member` whose name is 'Mighty' and return it.
+ If an entry is not found, then ``None`` is returned.
This is different from `filter`_ due to the fact it stops the moment it finds
a valid entry.
+
.. _filter: https://docs.python.org/3.6/library/functions.html#filter
- :param predicate: A function that returns a boolean-like result.
- :param seq: The sequence to iterate through.
- :return: The first result of the predicate that returned a ``True``-like value or ``None`` if nothing was found.
+ Parameters
+ -----------
+ predicate
+ A function that returns a boolean-like result.
+ seq : iterable
+ The iterable to search through.
"""
for element in seq: