Don Alias的な
メソッドを上書きせずに機能を追加したりできる。
# -*- coding: utf-8 -*- class Hoge def hoge puts 'Hoge#hoge!!' end end class Fuga < Hoge alias :hoge_real :hoge def hoge puts 'Fuga#hoge!!' hoge_real end end f = Fuga.new f.hoge # 実行結果 # Fuga#hoge!! # Hoge#hoge!!
これをPythonでも…出来るのだろうか。