inducer / arraycontext

Choose your favorite numpy-workalike!
6 stars 11 forks source link

Allow to manually exclude fields in dataclass_array_container #96

Open alexfikl opened 3 years ago

alexfikl commented 3 years ago

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!

inducer commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

alexfikl commented 2 years ago

@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.