Skip to content

Instantly share code, notes, and snippets.

@Everfighting
Last active June 21, 2022 09:26
Show Gist options
  • Select an option

  • Save Everfighting/7b280f628bad7d38b9679aa2d61bc01b to your computer and use it in GitHub Desktop.

Select an option

Save Everfighting/7b280f628bad7d38b9679aa2d61bc01b to your computer and use it in GitHub Desktop.
例如以下的代码是错误的
class Student(object):
# 方法名称和实例变量均为birth:
@property
def birth(self):
return self.birth
这是因为调用s.birth时首先转换为方法调用在执行return self.birth时又视为访问self的属性
于是又转换为方法调用造成无限递归最终导致栈溢出报错RecursionError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment