AttributeError: ‘super’ object has no attribute ‘ping’
super()
가 반환한
‘super’
객체에
ping
이라는 속성이 없다. 클래스
U
의
MRO
에는
U
와
object
가 있는데,
object
클래스에는
‘ping’
이라는 이름의 속성이 없기 때문이다.
그러나
U.ping()
메서드가 완전히 희망이 없는 것은 아니다. 다음 실행 예를 보자.
>>> leaf2 = LeafUA()
>>> leaf2.ping()
<instance of LeafUA>.ping() in LeafUA
<instance of LeafUA>.ping() in U
<instance of LeafUA>.ping() in A
<instance of LeafUA>.ping() ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.