デザパタ + python
■ このスレッドは過去ログ倉庫に格納されています
0080デフォルトの名無しさん
2007/03/02(金) 23:22:11抽象メソッドなんて言うのはC++やJavaのような静的なOOP言語のための機能で、
Pythonの場合、実行時にメソッドがなかったらAttributeErrorを吐くんだから
こんなもんわざわざ記述する必要ないでしょ。
>def myOpen(self): # サブクラスに実装をまかせる抽象メソッド(1)
> raise exceptions.NotImplementedError, '%s' %`self.__class__`
>def myPrint(self): # サブクラスに実装をまかせる抽象メソッド(2)
> raise exceptions.NotImplementedError, '%s' %`self.__class__`
>def myClose(self): # サブクラスに実装をまかせる抽象メソッド(3)
> raise exceptions.NotImplementedError, '%s' %`self.__class__`
■ このスレッドは過去ログ倉庫に格納されています