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

Document how to access internal dict for faster reads #16

Open
Downchuck opened this issue Sep 26, 2015 · 3 comments
Open

Document how to access internal dict for faster reads #16

Downchuck opened this issue Sep 26, 2015 · 3 comments

Comments

@Downchuck
Copy link

Currently, todict makes a copy of the full structure. Simply accessing (or documenting) the internal dict is much faster than using setattr/getattr and reflection.

@yihuang
Copy link
Owner

yihuang commented Sep 30, 2015

Why not post some code, i'm not sure exactly what you propose. ;D

@Downchuck
Copy link
Author

This may not even need code; it's simply a documentation note now.

entity.__dict__

is faster, when appropriate, for accessing fields than using setattr/getattr or creating a dictionary through:

entity.todict()

@Downchuck Downchuck changed the title torawdict could expose internal dict Document how to access internal dict for faster reads Oct 26, 2015
@yihuang
Copy link
Owner

yihuang commented Nov 10, 2015

__dict__ is different from todict, you get a object instance for submessage instead of dict.

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