Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reduce_to_map method to multi-dicts #100

Open
gabbard opened this issue Nov 11, 2019 · 0 comments
Open

Add reduce_to_map method to multi-dicts #100

gabbard opened this issue Nov 11, 2019 · 0 comments
Labels

Comments

@gabbard
Copy link

gabbard commented Nov 11, 2019

The logic would be along the lines of:

def reduce_to_dict(multidict: ImmutableListMultiDict[_KT, _VT],
                  value_reducer: Callable[[Iterable[_VT]], _VT2]) -> ImmutableDict[_KT,
                                                                             _VT2]:
    return immutabledict(
        (key, value_reducer(multidict[key]))
        for key in multidict.keys()
    )
@gabbard gabbard added the student label Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant