Skip to content

Instantly share code, notes, and snippets.

@shinh
Created November 6, 2018 06:43
Show Gist options
  • Save shinh/162f9db7aa300d68fd29ad92f51e7810 to your computer and use it in GitHub Desktop.
Save shinh/162f9db7aa300d68fd29ad92f51e7810 to your computer and use it in GitHub Desktop.
mypy with cyclic dep
import u
print(u.U().foo())
# import v
# class U(object):
# def foo(self) -> 'U':
# return v.V().bar(self)
from v import V
class U(object):
def foo(self) -> 'U':
return V().bar(self)
# import u
# class V(object):
# def bar(self, x) -> 'u.U':
# return x
# from u import U
class V(object):
def bar(self, x) -> 'U':
return x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment