如何理解使用任意数量的关键字实参?

序列1.2不怎会理解,我在群里也请教了一些人,本人有点笨…… 希望大牛们能看到这个问题 并帮我指点下执行流程 希望序列1.里的能仔细讲解下,实在想不出来了图片说明

图片说明


#!/usr/bin/env python
# coding: utf-8

def build_profile(first, last, **user_info):
    # 创建一个字典,包含用户的一切信息;
    profile = {}

    # 实质是向profile字典中添加key-value值, profile = {'first_name':first}
    profile['first_name'] = first

    # 实质是向profile字典中添加key-value值, profile = {'first_name':first, 'last_name': last}
    profile['last_name'] = last

    # 因为函数有关键字参数 **userinfo, 可以打印查看userinfo为字典类型;
    # user_info.items()显示传入userinfo的key-value值;
    # for key, value in user_info.items()实现遍历user_info字典,并把信息加入profile字典中;
    for key, value in user_info.items():
        profile[key] = value
    return profile


def main():
    user_profile = build_profile('albert', 'einstein',
                                 location='princetion', field='physics')
    print user_profile



if __name__ == "__main__":
    main()