avoid infinite recursion cross-validating defaults#435
Closed
minrk wants to merge 1 commit intoipython:masterfrom
Closed
avoid infinite recursion cross-validating defaults#435minrk wants to merge 1 commit intoipython:masterfrom
minrk wants to merge 1 commit intoipython:masterfrom
Conversation
When validating defaults, load initial values prior to cross-validation Downside: this means that accessing other values during validation can return non-final values in the event of cross-validation cycles (`@validate(a)` depends on self.b and `@validate(b)` depends on self.a). But this is only true for validated default values with cross-references where validation would mutate the default values, which is the same as having invalid default values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When validating defaults, load initial values prior to cross-validation
Downside: this means that accessing other values during validation can return non-final values in the event of cross-validation cycles (
@validate(a)depends on self.b and@validate(b)depends on self.a). But this is only true for validated default values with cross-references where validation would mutate the default values, which really really shouldn't happen.While this does appear to pass the ipywidgets and IPython tests with current stable versions, I'm not sure that cross-validating defaults is going to be worth the trouble. There are way too many edge cases where it could trigger, validating an unused value, raising an unhelpful error about code that's not relevant.
closes #363
closes #428
closes #434
closes jupyter-widgets/ipywidgets#1423
cc @rmorshea @SylvainCorlay @jasongrout