-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
refactorRefactor or redesign of existing codeRefactor or redesign of existing code
Description
We should replace getters and setters, which are an antipattern in Python (as exposed on #122 (comment)). Most of them can be replaced either by:
- The use of
@property(which allows custom code to run when access is attempted or an assignment is done); - Direct access to the attribute (i.e. just delete the get and set functions where they don't do anything at all besides just getting or setting).
As I exposed in #122 (comment), rather than having a set function for each attribute, we should (also) implement a general set function for dataclasses, which allows us to set multiple attributes at a time (and also to animate such setting), like so:
mobj.set(x=5, y=6, z_index=50, ...)
Setter functions which require more than one parameter could be kept anyways, and then simply invoked by .set when required.
Suggestions? Ideas?
Relevant PRs and comments (if there are more, please tell me or just edit this post): #122 (comment), #122 (comment), #116, #114
kilacoda-old
Metadata
Metadata
Assignees
Labels
refactorRefactor or redesign of existing codeRefactor or redesign of existing code