发送与接收大型数组-python cookbook(第3版)高清中文完整版

时间:2024-06-29 23:06:38
【文件属性】:

文件名称:发送与接收大型数组-python cookbook(第3版)高清中文完整版

文件大小:4.84MB

文件格式:PDF

更新时间:2024-06-29 23:06:38

python cookbook 第3版 高清 中文完整版

11.13 发送与接收大型数组 问题 You want to send and receive large arrays of contiguous data across a network connec‐ tion, making as few copies of the data as possible. 解决方案 The following functions utilize memoryviews to send and receive large arrays: # zerocopy.py def send_from(arr, dest): view = memoryview(arr).cast(‘B’) while len(view): nsent = dest.send(view) view = view[nsent:] def recv_into(arr, source):


网友评论