You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
w = Wiring()
w.this()
def my_callable():
print('called!')
w.wire.this.calls_to(my_callable)
In the example above, the unwired call w.this() has no effect. Would it be useful to support "buffering" of calls such that the previous example would "remember" the unwired call in w.this() and later call my_callable at wiring time?
Thoughts:
If possible, Wiring instances should default to "not doing this", behaving like "event systems" / "pub-sub systems" that just throw away "unhandled "events" / "unsubscribed messages".
Probably related to Support min/max callee count on callables. #3 (optional min/max callee setting) in the sense that delayed callee calling should be triggered, if activated, only when the min callee count is reached (or on the first wiring, if min is unset).
If possible, activating this behaviour should be configurable in "how many" buffer/delayed calls to keep track of.
Configurable at the Wiring instance level and at the individual callable level?
API possibility:
Have a track_unwired_callsWires initialisation argument:
Defaults to 0.
If set to a positive integer n: will track that amount of unwired calls.
If set to True: will track an unlimited number of unwired calls.
Example:
In the example above, the unwired call
w.this()has no effect. Would it be useful to support "buffering" of calls such that the previous example would "remember" the unwired call inw.this()and later callmy_callableat wiring time?Thoughts:
Wiringinstances should default to "not doing this", behaving like "event systems" / "pub-sub systems" that just throw away "unhandled "events" / "unsubscribed messages".Wiringinstance level and at the individual callable level?API possibility:
track_unwired_callsWiresinitialisation argument:n: will track that amount of unwired calls.True: will track an unlimited number of unwired calls.False: raise an exception if an unwired callable is called (conflict with idea in Support min/max callee count on callables. #3, needs thinking).