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

Implement __slots__ to avoid user confusion #508

Open
MicahGale opened this issue Aug 25, 2024 Discussed in #345 · 1 comment · May be fixed by #608
Open

Implement __slots__ to avoid user confusion #508

MicahGale opened this issue Aug 25, 2024 Discussed in #345 · 1 comment · May be fixed by #608
Assignees
Labels
code improvement A feature request that will improve the software and its maintainability, but be invisible to users. feature request An issue that improves the user interface.
Milestone

Comments

@MicahGale
Copy link
Collaborator

Discussed in #345

Originally posted by MicahGale August 2, 2023
TIL about slots in python: https://stackoverflow.com/questions/472000/usage-of-slots

Basically statically allocating python attributes. The benefit would be to guard against typos frustrating users. For instance cell.materail = mat.

@MicahGale MicahGale added code improvement A feature request that will improve the software and its maintainability, but be invisible to users. feature request An issue that improves the user interface. labels Aug 25, 2024
@MicahGale MicahGale self-assigned this Aug 25, 2024
@MicahGale MicahGale mentioned this issue Aug 25, 2024
35 tasks
@MicahGale MicahGale added this to the 1.0.0-alpha milestone Nov 8, 2024
@MicahGale MicahGale linked a pull request Dec 5, 2024 that will close this issue
21 tasks
@MicahGale
Copy link
Collaborator Author

The official strategy for this now is:

  1. All top level abstract classes have overwritten __setattr__ to avoid typos.
  2. __slots__ is only used for simple immutable classes where it is easy to enumerate everything.

For now this is all that will be done, and fully implementing slots is not the true solution for what is desired, and would be too costly to do effectively.

@MicahGale MicahGale modified the milestones: 1.0.0-alpha, M&C workshop Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code improvement A feature request that will improve the software and its maintainability, but be invisible to users. feature request An issue that improves the user interface.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant