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

Allow bind to extract dependencies and evaluate other dynamic functions #2056

Merged
merged 2 commits into from
Mar 12, 2021

Conversation

philippjfr
Copy link
Member

Allows binding another dynamic function:

slider = pn.widgets.IntSlider(value=2, start=0, end=10)
slider2 = pn.widgets.IntSlider(value=4, start=0, end=10)
slider3 = pn.widgets.IntSlider(value=2, start=0, end=10)

def add(a, b):
    return a + b

def divide(a, b):
     return a / b

bound = pn.bind(divide, pn.bind(add, slider, slider2), slider3)
assert bound() == 3

@philippjfr philippjfr changed the title Allow bind to extract dependencies of other dynamic function Allow bind to extract dependencies and evaluate other dynamic function Mar 5, 2021
@codecov
Copy link

codecov bot commented Mar 5, 2021

Codecov Report

Merging #2056 (acca37e) into master (85a1392) will increase coverage by 0.01%.
The diff coverage is 95.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2056      +/-   ##
==========================================
+ Coverage   84.43%   84.44%   +0.01%     
==========================================
  Files         178      178              
  Lines       20636    20670      +34     
==========================================
+ Hits        17423    17455      +32     
- Misses       3213     3215       +2     
Impacted Files Coverage Δ
panel/depends.py 83.82% <90.00%> (+0.49%) ⬆️
panel/tests/test_depends.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 85a1392...acca37e. Read the comment docs.

@jbednar jbednar changed the title Allow bind to extract dependencies and evaluate other dynamic function Allow bind to extract dependencies and evaluate other dynamic functions Mar 5, 2021
Copy link
Member

@jbednar jbednar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@philippjfr philippjfr merged commit f133c3f into master Mar 12, 2021
@philippjfr philippjfr deleted the bind_dynamic_function branch March 12, 2021 12:23
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

Successfully merging this pull request may close these issues.

2 participants