-
-
Notifications
You must be signed in to change notification settings - Fork 367
Description
Our RecvChanWrapper
class could be a subclass of MemoryReceiveChannel
, which would be lovely in that it allows use with synchronous context managers and the .close()
method.
(.receive_nowait()
is part of the API, but the implementation would have to be simply raise WouldBlock
!)
...of course, MemoryReceiveChannel
is currently marked @final
, which would make this harder. This isn't the only case where I'd like to be able to subclass it though - my async_map(fn, memory_recv_chan)
util would be nicer to use if I could return a (subclasses of) memory channel there too. Maybe this points us towards having a more general ReceiveChannelWrapper
type, which can be subclassed and customized? Although for type-checkers we'd want that to be a subclass...
Thoughts?