I'm trying to do following:
# Define a class named Type
class Type():
def __init__(self, id, symbol):
self.id = id
self.symbol = symbol
def is_free(self):
return self.id = LAND.id
# Define variables of this class
LAND = Type(-1, '.')
I wonder if there is forward declaration of class in Python?
EDIT:
I have seen the post Is it possible to forward-declare a function in Python?, but I don't think it's the same issue. Because the question is about forward declaration of function
, while I'm asking about class
.
I also read this post Does Python have class prototypes (or forward declarations)?, but it was asking about refer to a class in another class, while I'm asking about refer to variables of its own type within the class. I don't see my solution in this post, or can somebody who thinks it's duplicate explain a little bit?