New way of type/hinting/assignments is cool, but I don't know how to make such a simple thing work:
class MyContainer:
def addMyItem(self, item:MyItem):
pass
class MyItem:
def __init__(self, container:MyContainer):
pass
It throw an error: Using variable 'MyItem' before assignment
.
The best but super ugly workaround I found so far is this:
class MyContainer:
def addMyItem(self, untypeditem):
item:MyItem=untypeditem
pass
class MyItem:
def __init__(self, container:MyContainer):
pass
Please tell me that language with #1 principle Beautiful is better than ugly
has something better to solve this common typing issue