Message304093
| 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:30 | yselivanov | set | recipients:
+ yselivanov, pfreixes |
| 2017年10月10日 23:09:30 | yselivanov | set | messageid: <1507676970.48.0.213398074469.issue30457@psf.upfronthosting.co.za> |
| 2017年10月10日 23:09:30 | yselivanov | link | issue30457 messages |
| 2017年10月10日 23:09:30 | yselivanov | create |
|