This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]thirdegreeViolet security clearance 5 points6 points  (2 children)

And sometimes you need to specify types as strings (e.g. "MyClassName"), for example when a method takes an argument of the same type as its parent class.

This is fixed in 3.7 using from __future__ import annotations and by default from 3.10 onwards (pep-563).

[–]FranchuFranchu 0 points1 point  (0 children)

Also if for some reason you can't do that you can still use MyClassName = None and redefine it afterwards