Skip to content

Instantly share code, notes, and snippets.

@nakamuray
Created June 25, 2016 06:18
Show Gist options
  • Save nakamuray/df3271ed29d7701e2c98203a2d2167f6 to your computer and use it in GitHub Desktop.
Save nakamuray/df3271ed29d7701e2c98203a2d2167f6 to your computer and use it in GitHub Desktop.
循環して参照しているようなヤツの type hint どうやって書けばいいの?
class A(object):
# XXX: こういう、お互いに循環して使っているクラスの type hint ってどうやって書くの?
#def use_B(self, b: B):
def use_B(self, b):
print("I'm using {}".format(b))
class B(object):
def use_A(self, a: A):
print("I'm using {}".format(a))
a = A()
b = B()
a.use_B(b)
b.use_A(a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment