0

I would want to write:

class MyClass:
    def __le__(self, other:MyClass):
        ...
    def __ge__(self, other:MyClass):
        ...
    ...

Unfortunately, Python throws an error because MyClass isn't yet initialized. Is there another way to specify the type alias here?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Christian
  • 25,249
  • 40
  • 134
  • 225
  • If memory serves there is a way to use the name as a string now to specifically solve this problem. – quamrana Jul 03 '21 at 12:21
  • The _specific error_ is much more useful for making a question discoverable than _"an error"_, and searching for it would have found the dupe. – jonrsharpe Jul 03 '21 at 12:30

0 Answers0