牌語備忘録 -pygo

あくまでもメモです。なるべくオフィシャルの情報を参照してください。

牌語備忘録 -pygo

2012-06-12から1日間の記事一覧

『メタプログラミングRuby 1.2.1 クラス定義の中身』のオープンクラス == モンキーパッチ あたりの件

Python Pythonだとエラーになるが... class D: def x(self): return "x" class D: def y(self): return "y" obj = D() print obj.x() print obj.y() #=> Traceback (most recent call last): #=> File "qr_96298g4R.py", line 10, in <module> #=> print obj.x() #=></module>…

『メタプログラミングRuby 1.2.2 オープンクラスの問題点』でRubyのテストのやり方って? (おまけ:Pythonの場合)

Ruby の場合 Ruby1.9.3 replace.rb def replace(array, from, to) array.each_with_index do |e, i| array[i] = to if e == from end end test_replace.rb require 'minitest/unit' load 'replace.rb' MiniTest::Unit.autorun class ReplaceTest < MiniTest:…