Show bind call sites in debug mode
We can record the call sites of <some callable>.bind
, from within tonic._bind
, and show these in the debug mode print-out. This could help debugging.
>>> @tonic.configurable
... def f(a=1):
... pass
...
>>> with tonic.debug():
... with f.bind(a=2):
... f()
...
Calling @configurable `f` from <module>:3 with non-default parameters:
a = 2 (bound at <module>:2)
Right now we warn when a kwarg is already bound but a caller tries to override that value at the call site, e.g.
>>> with f.bind(a=3):
... f(a=4)
...
# warning
In debug mode, we could show all overrides of a function in the order we saw them. I don't know if we already warn for multiple .bind
s, but we can show those too.