Skip to content

Set Position3D as frozen#233

Merged
dave-doty merged 1 commit intoUC-Davis-molecular-computing:devfrom
cgevans:dev
Jul 21, 2022
Merged

Set Position3D as frozen#233
dave-doty merged 1 commit intoUC-Davis-molecular-computing:devfrom
cgevans:dev

Conversation

@cgevans
Copy link
Copy Markdown
Contributor

@cgevans cgevans commented Jul 21, 2022

Mutable defaults in dataclasses will cause an error in Python 3.11. HelixGroup has a Position3D default. Position3D appears to be intended to be immutable, and is never used mutably in the code, but does not have frozen=True set for the dataclass options. This sets it, and causes tests to pass with Python 3.11.0b4.

Alternatively, Position3D could be left as is, and the HelixGroup position could be made to be position: Position3D = field(default_factory=lambda: Position3D(x=0,y=0,z=0)), but this seems less efficient.

@cgevans cgevans requested a review from dave-doty as a code owner July 21, 2022 18:05
Copy link
Copy Markdown
Member

@dave-doty dave-doty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

@dave-doty dave-doty merged commit 0da04f4 into UC-Davis-molecular-computing:dev Jul 21, 2022
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

Successfully merging this pull request may close these issues.

2 participants