-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: Python class meta-programming for State construction #244
Conversation
079d82a
to
9e8185a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
It's gonna be sick when we add the custom kwargs and getters 🥳
Codecov Report
@@ Coverage Diff @@
## main #244 +/- ##
==========================================
+ Coverage 83.23% 83.27% +0.04%
==========================================
Files 63 63
Lines 4874 4886 +12
==========================================
+ Hits 4057 4069 +12
Misses 817 817
|
Co-authored-by: Vishwa Shah <vishwa2710@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether we can achieve this by using bindings directly and not Python code 🤔
I just dont' know
This MR is some Python-only syntactic sugar on top of the State Builder concept which allows for some nice syntax:
The output StateTypeX classes are polymorphic to State and so can be used anywhere a State can.
This example is 100% equivalent to using a builder and is just a syntax alternative.
(other meta-programming features like auto-assigning
state.mass
to get the mass value will be in a follow-up)