2007-04-22 釣りして泳いだ
■[Python]ようやく継続がちゃんと分かった気がする
ループにしちゃってるけどつまりはこんな事だと思う。
>>> class Test(): ... def __init__(self): ... self.state = {} ... def continuation_generator(self): ... while True: ... req = self.state['request'] ... yield 'receive: %s' % req ... >>> >>> t = Test() >>> t.state['request'] = 1 >>> c = t.continuation_generator() >>> c.next() 'receive: 1' >>> t.state['request'] = 10 >>> c.next() 'receive: 10'
トラックバック - http://d.hatena.ne.jp/jbking/20070422/p3
リンク元
- 15 http://reader.livedoor.com/reader/
- 8 http://d.hatena.ne.jp/asin/4873113202
- 6 http://r.hatena.ne.jp/kfuruhata/
- 6 http://tf0054.blogspot.com/2007/03/linux-scapy.html
- 6 http://www.google.com/reader/view/
- 5 http://d.hatena.ne.jp/johzan/
- 5 http://d.hatena.ne.jp/keyworddiary/Ruby
- 5 http://del.icio.us/shunuhs?page=3
- 4 http://asyura.homelinux.net/~combat/freshreader/feedshow.php?h=3f4600a8bd1c&c=c9c56d4
- 3 http://b.hatena.ne.jp/kakutani/java2ruby/