Skip to content

Allow to manually exclude fields in dataclass_array_container #96

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexfikl
Copy link
Collaborator

@alexfikl alexfikl commented Oct 5, 2021

This isn't as nice as it could be due to backwards compatibility, but it seems to work.

EDIT: Actually, this doesn't work for what I wanted to use it for. I'll leave it here in case you think it's still useful, but otherwise feel free to close!

@alexfikl alexfikl force-pushed the dataclass-exclude-fields branch from 026fac2 to c339786 Compare October 6, 2021 14:01
@inducer
Copy link
Owner

inducer commented Oct 6, 2021

For the use case, could you simply stuff the extra fields into another dataclass that's not an array container? (And send them "along for the ride" that way?)

@alexfikl
Copy link
Collaborator Author

alexfikl commented Oct 6, 2021

For the use case, could you simply stuff the extra fields into another dataclass that's not an array container? (And send them "along for the ride" that way?)

Yeah, I ended up doing a combination of that and some memoizing, since otherwise they would get out of sync.

@inducer
Copy link
Owner

inducer commented Oct 6, 2021

In that case, I'd say let's hold off here. I won't close it, but I'll add a "shelved" tag.

@inducer inducer added the shelved label Oct 6, 2021
@alexfikl alexfikl force-pushed the dataclass-exclude-fields branch from c339786 to e13472b Compare October 23, 2021 16:02
@alexfikl alexfikl force-pushed the dataclass-exclude-fields branch 4 times, most recently from 17bf2a1 to 4f6d97c Compare October 30, 2021 00:55
@alexfikl
Copy link
Collaborator Author

@inducer Tried to use that Annotated type to explicitly exclude fields from the dataclass and it seems to be working quite nicely. Don't have a Python 3.6 environment to check that it works there too, but it should if typing_extensions works as advertised.

@alexfikl alexfikl force-pushed the dataclass-exclude-fields branch 2 times, most recently from 5266cd1 to 0083db2 Compare October 30, 2021 01:11
@alexfikl alexfikl force-pushed the dataclass-exclude-fields branch from 0083db2 to 6f1ba91 Compare December 2, 2021 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants