Skip to content

Instantly share code, notes, and snippets.

@ojii
Created April 3, 2018 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojii/909fe76f2c88b0e70cc5827bfbb3f5e2 to your computer and use it in GitHub Desktop.
Save ojii/909fe76f2c88b0e70cc5827bfbb3f5e2 to your computer and use it in GitHub Desktop.
from typing import *
T = TypeVar('T')
class NonTrueAwaitable(Generic[T]):
def __init__(self, inner: Awaitable[T]):
self.inner = inner
def __bool__(self) -> bool:
return False
def __await__(self):
val = yield from self.inner
return val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment