friends = ['Rolf', 'Jose', 'Randy', 'Anna', 'Mary']
friends_lower = map(lambda x: x.lower(), friends)
print(next(friends_lower))
# this is equivalent to:
friends_lower = [f.lower() for f in friends]
friends_lower = (f.lower() for f in friends)  # prefer generator comprehension over the other two


class User:
    def __init__(self, name, password):
        self.name = name
        self.password = password

    @classmethod
    def from_dict(cls, data):
        return self(data['name'], data['password'])

user_list = [
    {'name': 'Jose', 'password': '123'},
    {'name': 'Rolf', 'password': '456'}
]

users = [User.from_dict(user) for user in user_list]
# in this case map is preferable because it is more readable
# and there no overhead of declaring a variable 'user' as in the comprehension
users = map(User.from_dict, user_list)

c92eb2d64a506f56af0ce03156176b1766f67d22
<mask token>


class User:
    <mask token>

    @classmethod
    def from_dict(cls, data):
        return self(data['name'], data['password'])


<mask token>

<mask token>


class User:

    def __init__(self, name, password):
        self.name = name
        self.password = password

    @classmethod
    def from_dict(cls, data):
        return self(data['name'], data['password'])


<mask token>

<mask token>
print(next(friends_lower))
<mask token>


class User:

    def __init__(self, name, password):
        self.name = name
        self.password = password

    @classmethod
    def from_dict(cls, data):
        return self(data['name'], data['password'])


<mask token>

friends = ['Rolf', 'Jose', 'Randy', 'Anna', 'Mary']
friends_lower = map(lambda x: x.lower(), friends)
print(next(friends_lower))
friends_lower = [f.lower() for f in friends]
friends_lower = (f.lower() for f in friends)


class User:

    def __init__(self, name, password):
        self.name = name
        self.password = password

    @classmethod
    def from_dict(cls, data):
        return self(data['name'], data['password'])


user_list = [{'name': 'Jose', 'password': '123'}, {'name': 'Rolf',
    'password': '456'}]
users = [User.from_dict(user) for user in user_list]
users = map(User.from_dict, user_list)

friends = ['Rolf', 'Jose', 'Randy', 'Anna', 'Mary']
friends_lower = map(lambda x: x.lower(), friends)
print(next(friends_lower))
# this is equivalent to:
friends_lower = [f.lower() for f in friends]
friends_lower = (f.lower() for f in friends)  # prefer generator comprehension over the other two


class User:
    def __init__(self, name, password):
        self.name = name
        self.password = password

    @classmethod
    def from_dict(cls, data):
        return self(data['name'], data['password'])

user_list = [
    {'name': 'Jose', 'password': '123'},
    {'name': 'Rolf', 'password': '456'}
]

users = [User.from_dict(user) for user in user_list]
# in this case map is preferable because it is more readable
# and there no overhead of declaring a variable 'user' as in the comprehension
users = map(User.from_dict, user_list)
