Created
June 25, 2016 06:18
-
-
Save nakamuray/df3271ed29d7701e2c98203a2d2167f6 to your computer and use it in GitHub Desktop.
循環して参照しているようなヤツの type hint どうやって書けばいいの?
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
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