1

It seems like in Python 3, I can't let a class reference to itself:

class A:
    def test(self, param: A):
            print('Hello World')

Python gives me this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in A
NameError: name 'A' is not defined

I can I make this code work?

mitchkman
  • 6,201
  • 8
  • 39
  • 67

0 Answers0