Created
April 3, 2018 09:25
-
-
Save ojii/909fe76f2c88b0e70cc5827bfbb3f5e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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