enumap.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:enumap 作者: TadLeonard 项目源码 文件源码
def _iter_member_defaults(members):
    """Iterates through Enum members and teases out the default value
    the user selected with `default(<user's special value>)` from the
    `default` object.
    """
    for k, v in members.items():
        if isinstance(v.value, default):
            yield k, v.value.default

        # By not yielding k, v for non-default() objects, we avoid using
        # things like auto() as defaults in our .tuple()/.map() collections.
        # This makes it explicit when a user is using an enum value
        # as a default while ALSO allowing SparseEnumaps to adhere to the
        # rules of Enums. Each value of an Enum must be unique, and those that
        # aren't are basically just aliases
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号