【发布时间】:2021-12-15 03:49:24
【问题描述】:
class Person:
def __init__(self, ......
def make_friend(self, friend: 'Person') -> None:
.....
我正在学习 python,但我不明白这个例子。为什么朋友的类型条件应该用单引号引起来?为什么不friend: Person?它是如何工作的?它与类型类快捷方式有什么共同之处吗?
【问题讨论】: