python
1class sml(list): 2 def __new__(cls): 3 print(type(cls)) 4 return super().__new__(cls) 5 6 def __init__(self): 7 print(type(self)) 8 9i = sml()
上記のコードは
<class 'type'> <class '__main__.sml'>
という結果を出力したのですが、__new__の第一引数は何を指しているのですか。
またtype(type(self))として出力した結果、
python
1class sml(list): 2 def __new__(cls): 3 print(type(cls)) 4 return super().__new__(cls) 5 6 def __init__(self): 7 print(type(type(self))) 8 9i = sml()
<class 'type'> <class 'type'>
という結果になったのですが、これはtypeクラスというクラスがクラスを作ってることになるんですか?またreturn super().new(cls)では何を返しているんでしょうか。

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。