Fixed examples, see #332

The examples were using generator expressions instead of list comprehensions
This commit is contained in:
Mads Marquart
2018-09-09 14:24:20 +02:00
committed by GitHub
parent 51c3226070
commit 08117e7a54

View File

@@ -8,8 +8,8 @@ client = Client('<email>', '<password>')
# Fetches a list of all users you're currently chatting with, as `User` objects # Fetches a list of all users you're currently chatting with, as `User` objects
users = client.fetchAllUsers() users = client.fetchAllUsers()
print("users' IDs: {}".format(user.uid for user in users)) print("users' IDs: {}".format([user.uid for user in users]))
print("users' names: {}".format(user.name for user in users)) print("users' names: {}".format([user.name for user in users]))
# If we have a user id, we can use `fetchUserInfo` to fetch a `User` object # If we have a user id, we can use `fetchUserInfo` to fetch a `User` object
@@ -18,7 +18,7 @@ user = client.fetchUserInfo('<user id>')['<user id>']
users = client.fetchUserInfo('<1st user id>', '<2nd user id>', '<3rd user id>') users = client.fetchUserInfo('<1st user id>', '<2nd user id>', '<3rd user id>')
print("user's name: {}".format(user.name)) print("user's name: {}".format(user.name))
print("users' names: {}".format(users[k].name for k in users)) print("users' names: {}".format([users[k].name for k in users]))
# `searchForUsers` searches for the user and gives us a list of the results, # `searchForUsers` searches for the user and gives us a list of the results,