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

refactor: use named tuples instead of dataclasses for timestep and state #91

Open
dluo96 opened this issue Mar 27, 2023 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@dluo96
Copy link
Contributor

dluo96 commented Mar 27, 2023

Is your feature request related to a problem? Please describe

Since the dataclasses we use are mutable, some side effects may occur when working with environment State and TimeStep.

Describe the solution you'd like

Use NamedTuple instead.

Describe alternatives you've considered

We could also freeze the dataclasses to be immutable but the NamedTuple option is preferred.

@dluo96 dluo96 added the enhancement New feature or request label Mar 27, 2023
@aar65537
Copy link
Contributor

aar65537 commented Apr 6, 2023

This should be possible in python 3.11, but 3.9 and 3.10 don't allow a class to inherit from both NamedTuple and Generic (see python/cpython#88089). 3.8 does allow for generic named tuples, but I'm not sure if they really function correctly. I think the choices are to either drop support for 3.8, 3.9, and 3.10 or use frozen dataclasses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants