Pythonのtypeなー。メタクラスの話。
http://d.hatena.ne.jp/elecsta/20080729#p4
In [1]: Hoge = type('Hoge', (object,), {'foo': lambda self:'bar'}) In [2]: h = Hoge() In [3]: h.foo() Out[3]: 'bar'
なかなかおもしろい。
Pythonのtypeなー。メタクラスの話。
http://d.hatena.ne.jp/elecsta/20080729#p4
In [1]: Hoge = type('Hoge', (object,), {'foo': lambda self:'bar'}) In [2]: h = Hoge() In [3]: h.foo() Out[3]: 'bar'
なかなかおもしろい。