Yury Selivanov <yseliva...@gmail.com> added the comment:

Isn't this code equivalent to yours:

async def get(process, key):
    try:
        return cache[key]
    except KeyError:
        if key in events:
            await events[key].wait()
        else:
            events[key] = asyncio.Event()

            # simulates some IO to get the Key
            await asyncio.sleep(0.1)
            cache[key] = "some random value"
            event.set()

        return cache[key]


?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue30457>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to