In this lesson, you’ll clean up your code by using more functions from
discord.py, namely the utility functions. The first utility,
discord.utils.find(), can improve the simplicity and readability of this code by replacing the
for loop with an intuitive, abstracted function.
find() takes a function, called a predicate, which identifies some characteristic of the element in the iterable that you’re looking for.
The other utility you’ll practice with is
get(), which takes the iterable and some keyword arguments. The keyword arguments represent attributes of the elements in the iterable that must all be satisfied for
get() to return the element.
Comments & Discussion
Become a Member to join the conversation.