-
Notifications
You must be signed in to change notification settings - Fork 9
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 internals
parameter to as_dict
/as_tuple
#62
Comments
I would rather have an extra argument than these functions to introspect the class because it gives the user more control (you could easily want some fields to not show up in the |
Right - to use It is the exact functionality you mention that I am primarily using them for in my project:
but using an internal variable to keep track of various subclasses of component dataclasses. I can share an example if this doesn't make sense of course. So potentially the additional functionality would be to add an |
Sorry, I misunderstood because of the simplicity of your example.
Yes, I would do exactly this. |
No worries - I could have shared all of my current huge dataclasses but it's a lot to type out, was easier at first to share a simple example. Thanks for the feedback! I'll see if I can fit time to make this change and submit a PR soon. |
internals
parameter to as_dict
/as_tuple
Simple example
From the README,
hide_internals
isTrue
by default but seems to only apply to:Is there any case where we would want to definitely want to expose internal fields in the dictionary representation?
I see
internals=True
by default here infunctions.py
, maybe it should pass thehide_internals
option instead of settingTrue
automatically.https://github.com/biqqles/dataclassy/blob/master/dataclassy/functions.py#L65-L69
I don't mind making this change but just want to see if I am missing any use cases.
The text was updated successfully, but these errors were encountered: