tomjnixon / yarp

Yet Another Reactive(-ish) Programming library for Python
0 stars 0 forks source link

consider moving attribute access to a sub-object #10

Open tomjnixon opened 1 year ago

tomjnixon commented 1 year ago

For example, instead of writing

>>> v = Value(1j)
>>> v.real
Value(0.0)

It might be:

>>> v.attrs.real
Value(0.0)

Advantages of this change:

The main disadvantage of changing is that it makes it less likely that Values will just work in normal code. On the other hand, the code that this would work with is very limited, and you'd be better off using fn anyway.

tomjnixon commented 1 year ago

Just got bit by this again:

async def event_listen(path, client):
    event = yarp.Event()
    await client.event_listen_cb(path, event.emit_event)
    return event

emit_event should just emit, but results in another Event, and because __call__ is wrapped too, when the callback is called, nothing happens

i definitely want to move some of this into a proxy, probably attribute access and calling (or just remove them and use functions)