kazoo
kazoo copied to clipboard
DataWatch is using TypeError to detect the arity of callback function
In kazoo/recipe/watchers.py line 163.
try:
result = self._func(data, stat, event)
except TypeError:
result = self._func(data, stat)
It's too terrible since a lot of error could raise a TypeError. Two better ways may be
- Like
ChildrenWatch, add asend_eventparameter. - Use
len(inspect.getargspec(self._func).args)to decide the arity first.