Skip to content

Clarification on ambiguous as_dict() #47

Description

@devleaks

Hello,

I apologize if I misunderstand the documentation but what is the purpose of the as_dict() help function?

import flatdict

>>> c = flatdict.FlatDict({"a": {"b":1}})
>>> print(type(c), c)
<class 'flatdict.FlatDict'> {'a:b': 1}

>>> d = flatdict.FlatDict({"a": {"b":1}}).as_dict()
>>> print(type(d), d)
<class 'dict'> {'a': {'b': 1}}

>>> e = dict(flatdict.FlatDict({"a": {"b":1}}))
>>> print(type(e), e)
<class 'dict'> {'a:b': 1}

I understood that as_dict() returns the result (the flattened dict) as a standard python dictionary rather than a flatdict.FlatDict object. It is not the case. Can you please clarify, and lift the ambiguity in the doc. Thank you.

Otherwise, this is a very handy package. Thank you.

P.

PS: Calling with .as_dict() takes a lot of time on larger dictionaries.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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