Skip to content
Snippets Groups Projects

Implement global (unscoped) bind

Merged Rosen Matev requested to merge rmatev-tonic into master
  • implement global (unscoped) bind f.global_bind()
  • (internal) keep a bind arguments stack per configurable rather than a single global stack
  • add an options file globally setting the FT decoding version to v2
  • fix a bug in the downloading inputs for tests

A global (unscoped) bind is useful in cases where the binding and the calls to the configurables need to happen in different places. The input raw data handling already was already globally configured using a workaround, which is now replaced with the new feature. The use of this should be restricted to special cases like this, and top level options (although there bind should be preferred).

@configurable
def f(x):
    return x

f.global_bind(x=2)
print(f())  # prints 2

As with bind, a second consecutive global_bind will warn if the same parameter is bound. Doing a global_bind inside a bind context will raise an exception.

Edited by Rosen Matev

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Alex Pearce
  • Alex Pearce
  • Alex Pearce
  • Alex Pearce
  • Alex Pearce approved this merge request

    approved this merge request

  • Rosen Matev added 1 commit

    added 1 commit

    • 91811d76 - Apply suggestion to PyConf/python/PyConf/tonic.py

    Compare with previous version

  • Rosen Matev mentioned in issue #88

    mentioned in issue #88

  • Alex Pearce resolved all threads

    resolved all threads

  • Alex Pearce mentioned in issue #89

    mentioned in issue #89

  • This is a nice little enhancement. We will try to minimise the number of global binds, but they do have their place (we should document that :smile: )

    Let's go! :rocket:

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading