コード例 #1
0
 def f():
     result = []
     coro = ClonableCoroutine()
     coro.bind(T(result))
     result.append(1)
     coro.switch()
     result.append(6)
     n = 0
     for i in result:
         n = n*10 + i
     return n
コード例 #2
0
 def f():
     result = []
     coro = ClonableCoroutine()
     coro.bind(T(result))
     result.append(1)
     coro.switch()
     result.append(6)
     n = 0
     for i in result:
         n = n * 10 + i
     return n
コード例 #3
0
ファイル: test_choicepoint.py プロジェクト: alkorzt/pypy
    def call(self):
        search_coro = ClonableCoroutine()
        search_coro.bind(SearchTask())
        choicepoints.add(search_coro)

        #os.write(1, "starting\n")
        while choicepoints.more_choices():
            searcher, nextvalue = choicepoints.next_choice()
            choicepoints.clone_me = False
            choicepoints.answer = nextvalue
            #os.write(1, '<<< {%x} %d\n' % (id(searcher), nextvalue))
            searcher.switch()
            #os.write(1, '>>> %d\n' % (choicepoints.clone_me,))
            if choicepoints.clone_me:
                searcher2 = searcher.clone()
                #os.write(1, 'searcher = {%x}, searcher2 = {%x}\n' % (
                #    id(searcher), id(searcher2)))
                choicepoints.add(searcher, 5)
                choicepoints.add(searcher2, 4)
コード例 #4
0
    def call(self):
        search_coro = ClonableCoroutine()
        search_coro.bind(SearchTask())
        choicepoints.add(search_coro)

        #os.write(1, "starting\n")
        while choicepoints.more_choices():
            searcher, nextvalue = choicepoints.next_choice()
            choicepoints.clone_me = False
            choicepoints.answer = nextvalue
            #os.write(1, '<<< {%x} %d\n' % (id(searcher), nextvalue))
            searcher.switch()
            #os.write(1, '>>> %d\n' % (choicepoints.clone_me,))
            if choicepoints.clone_me:
                searcher2 = searcher.clone()
                #os.write(1, 'searcher = {%x}, searcher2 = {%x}\n' % (
                #    id(searcher), id(searcher2)))
                choicepoints.add(searcher, 5)
                choicepoints.add(searcher2, 4)