강의

멘토링

로드맵

Inflearn Community Q&A

tjstod88564152's profile image
tjstod88564152

asked

Python Programming

Exception handling

예외처리에서 super사용 질문

Written on

·

174

0

2가지 질문이 있습니다. 

첫번째는

class Myexception(Exception):

def __init__(self, e):

super().__init__('{0}으로 나눌수 없습니다.'.format(e))

여기서 super를 사용해서 exception클래스의 생성자를 가져오는데 , 왜 super().init()으로 가져오지 않고 괄호안에 문구를 넣는 이유가 먼가요?

두번째는

왜 구지 super를 써서 생성자를 가져오는 건가요

print('{0}으로 나눌수 없습니다.'.format(e))

위와 같은 문구를 생성자에 추가하면 되지 않을까 생각해서 해봤는데, 출력될 때 두번 출력이 되던데 이유가 먼가요.........

python

Answer

This question is waiting for answers
Be the first to answer!
tjstod88564152's profile image
tjstod88564152

asked

Ask a question