TYPING: add some type hints to core.generic by simonjayhawkins · Pull Request #27646 · pandas-dev/pandas (original) (raw)
because we're still supporting Python 3.5 we are using a comment-based syntax for variable annotations.
_AXIS_ALIASES = None # type: Dict[str, int]
and to be valid Python syntax need to initialize to None, whereas shortly when we drop Python 3.5 we can use..
_AXIS_ALIASES: Dict[str, int]
and we can declare the variable type without any initialization necessary which will not change runtime behaviour.
so my preference is to add if TYPE_CHECKING: blocks for compatibility with Python 3.6 and simplify the adoption of Pyhton 3.6 variable annotations when we drop Python 3.5.