2008-10-17から1日間の記事一覧

new

ref:http://d.hatena.ne.jp/mopemope/20081017/p1 2パターン。 その1。 import new class A(object): pass def test(self): print "test" a = A() a.test = new.instancemethod(test, a, A) print repr(a) # <bound method A.test of <__main__.A object at 0x016D3BD0>> a.test() # test b = A() b.test() # Attribute</bound>…