类型提示python 3代码的向后兼容性

类型提示python 3代码的向后兼容性,python,python-2.7,python-3.x,type-hinting,Python,Python 2.7,Python 3.x,Type Hinting,有没有办法让python 3代码也包含python 2 def get(axyz: list, window_size: int=WINDOW_SIZE) -> numpy.array: return numpy.array(axyz) 更重要的是,即使是可能的?类型注释语法在python2中也无效。提到了与python2兼容的存根文件

有没有办法让python 3代码也包含python 2

def get(axyz: list, window_size: int=WINDOW_SIZE) -> numpy.array:
    return numpy.array(axyz)

更重要的是,即使是可能的?

类型注释语法在python2中也无效。提到了与python2兼容的存根文件