This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients pfreixes, yselivanov
Date 2017-10-10.23:09:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1507676970.48.0.213398074469.issue30457@psf.upfronthosting.co.za>
In-reply-to
Content
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]


?
History
Date User Action Args
2017-10-10 23:09:30yselivanovsetrecipients: + yselivanov, pfreixes
2017-10-10 23:09:30yselivanovsetmessageid: <1507676970.48.0.213398074469.issue30457@psf.upfronthosting.co.za>
2017-10-10 23:09:30yselivanovlinkissue30457 messages
2017-10-10 23:09:30yselivanovcreate