【发布时间】:2018-11-14 18:15:17
【问题描述】:
我有 python def 定义似乎适用于 python3:
def get_default_device(use_gpu: bool = True) -> cl.Device:
在python2下出现以下语法错误:
Traceback (most recent call last):
File "map_copy.py", line 9, in <module>
import utility
File "/home/root/pyopencla/ch3/utility.py", line 6
def get_default_device(use_gpu: bool = True) -> cl.Device:
^
SyntaxError: invalid syntax
如何使类型提示与 python2 兼容?
【问题讨论】:
-
通过删除类型提示
标签: python python-2.x python-typing