In an exception handler for a CSP style process, I need to read and discard the entire contents of a channel in order to allow other processes that are blocking to send to i
You might try:
reduce(lambda _, __: None, chan)
But honestly I don't think you're going to do much better than the plain loop. "channel" suggests I/O which is going to be the bottleneck anyway.