Skip to content

tracking some ideas #347

@kurtbrose

Description

@kurtbrose

These need gardening but I'll just put them here to keep track.

def get_any(dict, *keys, default=None):
    """Cascading get, for those times you do `dict.get(key1, dict.get(key2, ...))"""
    for key in keys:
        if key in dict:
            return dict[key]
    return default

But I had another take on get_any() here, so need to resolve that.
#266

Another one is a multi-partition, where predicates cascade:

future, current, past = partition(items, lambda item: item.start > now, lambda item: item.end > now)

(this could be an extension of iterutils.partition to accept any number of predicates instead of just one)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions