Skip to content

Commit

Permalink
Merge 3867a70 into a1adb2f
Browse files Browse the repository at this point in the history
  • Loading branch information
ceball committed Sep 13, 2020
2 parents a1adb2f + 3867a70 commit 2b5dbb2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions param/parameterized.py
Expand Up @@ -494,7 +494,7 @@ def _params_depended_on(minfo):


def _m_caller(self, n):
def caller(event):
def caller(*events):
return getattr(self,n)()
caller._watcher_name = n
return caller
Expand Down Expand Up @@ -2481,9 +2481,12 @@ def __init__(self, **params):
# instantiation of Parameterized with watched deps. Will
# probably store expanded deps on class - see metaclass
# 'dependers'.
for p in self.param.params_depended_on(n):
grouped = defaultdict(list)
for dep in self.param.params_depended_on(n):
grouped[(id(dep.inst),id(dep.cls),dep.what)].append(dep)
for group in grouped.values():
# TODO: can't remember why not just pass m (rather than _m_caller) here
(p.inst or p.cls).param.watch(_m_caller(self, n), p.name, p.what, queued=queued)
(dep.inst or dep.cls).param.watch(_m_caller(self, n), [dep.name for dep in group], dep.what, queued=queued)

self.initialized = True

Expand Down

0 comments on commit 2b5dbb2

Please sign in to comment.