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

Think about removing methods from dataclasses #79

Open
hawkrives opened this issue Feb 8, 2020 · 0 comments
Open

Think about removing methods from dataclasses #79

hawkrives opened this issue Feb 8, 2020 · 0 comments

Comments

@hawkrives
Copy link
Contributor

I've been realizing that the intent behind most "data classes" is to have no/very few methods on them, as they're intended to act like "records".

It would be interesting to experiment with making the DP classes into "records"?

Alternately, another idea might be to move from subclassing Rule > Solution > Result, to having a (say) CourseRule record, which is attached to a CourseSolution record, which is attached to a CourseResult record?

So instead of having to copy all of the properties, and subclassing as we do now, we could just essentially stick a pointer into it.

Something like

class CourseRule:
    course: str 

class CourseSolution:
    rule: CourseRule

class CourseResult:
    solution: CourseSolution
    
    def rank(self) -> Decimal:
        ... 

Hmm. Something like that.

@hawkrives hawkrives changed the title Think about remove methods from dataclasses Think about removing methods from dataclasses Feb 8, 2020
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

No branches or pull requests

1 participant