0

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?

zhm
  • 3,513
  • 3
  • 34
  • 55
  • @wim Please see my edit, I don't see this as a duplicate of [Does Python have class prototypes (or forward declarations)?](https://stackoverflow.com/questions/524714/does-python-have-class-prototypes-or-forward-declarations) Can you please help me remove the duplicate mark? – zhm Apr 23 '18 at 03:04
  • @wim Never mind, I have asked a new question. – zhm Apr 23 '18 at 03:19

0 Answers0