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

Enhancement: to_dict method #783

Open
Goldziher opened this issue Nov 7, 2022 · 1 comment
Open

Enhancement: to_dict method #783

Goldziher opened this issue Nov 7, 2022 · 1 comment

Comments

@Goldziher
Copy link

Goldziher commented Nov 7, 2022

Hi there,

Thanks for this library. I'd like to ask for a convenience method that output a dict of a multidict - with lists for multi-values. Currently I have this:

    def dict(self) -> Dict[str, List[Any]]:
        """

        Returns:
            A dict of lists
        """
        return {k: self.getall(k) for k in set(self.keys)}

While this works, its not very performant.

@asvetlov
Copy link
Member

Hey!
I doubt if it can be faster if implemented in C.
Did you try to implement the proposed method?
Do you have any performance numbers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants