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

non-recursive dict() #1518

Closed
psippola opened this issue May 15, 2020 · 1 comment
Closed

non-recursive dict() #1518

psippola opened this issue May 15, 2020 · 1 comment

Comments

@psippola
Copy link

BaseModel.dict() seems to be always recursive because to_dict=True in arguments of _iter. Could to_dict=True be added to the parameters of dict() to optionally do a non-recursive dict conversion?

        return dict(
            self._iter(
                to_dict=True,        # -> to_dict=to_dict
                by_alias=by_alias,
                include=include,
                exclude=exclude,
                exclude_unset=exclude_unset,
                exclude_defaults=exclude_defaults,
                exclude_none=exclude_none,
            )
        )
@samuelcolvin
Copy link
Member

better to use _iter directly, see #1001 for a discussion on why it's currently private.

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