-
Notifications
You must be signed in to change notification settings - Fork 31
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
[CX-1182] Feat: lazychain #389
Conversation
0306735
to
7a9fdcc
Compare
b5ddd43
to
f0935e5
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.
No big remarks here; don't forget to squash!
@@ -35,6 +40,7 @@ def __len__(self): | |||
return len(self._items) | |||
|
|||
|
|||
@parameters_attr |
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.
As discussed in person, this feels a bit error-prone. However, I'm fine with just being careful with it every time a *what needs to extends the ProtoState
.
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 added some reasoning behind this decorator in the docstring of parameters_attr
in protowhat to make it easy to understand why this was done in the future (when we want to think of a solution that eliminates this trade-off).
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.
To have the parameters attribute value available on the whole State class hierarchy and its instances without recalculation or decorator (or a manual list), State in protowhat could get a metaclass with a parameters property that memoizes the value.
I chose this because it's easier to understand, but one metaclass in protowhat would prevent having to think about it in xwhats.
class F(ProtoF): | ||
def __init__(self, stack=None, attr_scts=sct_dict): | ||
super().__init__(stack, attr_scts) | ||
def Ex(state=None): |
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.
Why not:
Ex = ExGen(sct_dict, State.root_state)
?
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.
This causes trouble with dill when using the manual converter feature.
I'll clarify the last commit message a bit:
Dilling a custom converter function causes globals to be dilled too.
The root_state attribute on ChainStart instances (e.g.ExGen(...)
) includes things that can't be dilled.
The manual converters are being phased out.
dilling a custom converter function causes globals to be converted the root_state attribute on ChainStart instances includes things that can't be dilled
1abf7c4
to
3de9cd4
Compare
Codecov Report
@@ Coverage Diff @@
## master #389 +/- ##
=========================================
- Coverage 94.18% 93.98% -0.2%
=========================================
Files 26 26
Lines 2115 2128 +13
=========================================
+ Hits 1992 2000 +8
- Misses 123 128 +5
Continue to review full report at Codecov.
|
Update pythonwhat to build on this protowhat PR.