<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          golessPython 并發(fā)編程庫

          聯(lián)合創(chuàng)作 · 2023-09-29 13:40

          使用 goless 庫,你可以用 Python 語言編寫 Go 語言風(fēng)格的并發(fā)程序。goless 提供了 channels、select 和 gooutines 的函數(shù),允許你使用 Go 語言漂亮和優(yōu)雅的并發(fā)編程模型,但是以你習(xí)慣的 Python 方式。goless 基于 gevent、PyPy 或者 Stackless Python 構(gòu)建,可用于 PyPy、CPython 和 Stackless Python 解釋器,支持 Python 2.6 到 3.4

          示例代碼:

          """
          A really simple example to use when demonstrating goless.
          """
          from __future__ import print_function
          
          import goless
          
          
          def simple():
              channel = goless.chan()
          
              def goroutine():
                  while True:
                      value = channel.recv()
                      channel.send(value ** 2)
              goless.go(goroutine)
          
              for i in range(2, 5):
                  channel.send(i)
                  squared = channel.recv()
                  print('%s squared is %s' % (i, squared))
          
              # Output:
              # 2 squared is 4
              # 3 squared is 9
              # 4 squared is 16
          
          if __name__ == '__main__':
              simple()
          瀏覽 21
          點贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  国产欧美日韩在线播放 | 亚洲色图网站 | 无码骚逼日逼T V | 日本黄色视频网站在线观看 | 亚洲黄色免费电影 |