python-broqer icon indicating copy to clipboard operation
python-broqer copied to clipboard

Handle publishers in arguments for method calls

Open semiversus opened this issue 6 years ago • 0 comments

When doing a method call on a publisher, the arguments of this call have to be constant:

>>> v = Value('Hello World')
>>> v.split(sep=' ') | op.Sink(print)
['Hello', 'World']

It would be possible be digging into broqer.op.operator_overloading:_GetAttr to allow publishers as argument values. When a publisher argument is emitting a new value, the method call should be re-evaluated.

>>> v = Value('Hello World')
>>> remove_str = Value('World')
>>> v.replace(remove_str, '') | op.Sink(print)
Hello 

>>> remove_str.emit('Hello')
 World

semiversus avatar Oct 01 '18 11:10 semiversus