1604
备注:
|
1737
|
删除的内容标记成这样。 | 加入的内容标记成这样。 |
行号 32: | 行号 32: |
=== 你需要知道的 === ==== 阻塞的操作 ==== ==== 异常 ==== ==== 调试 ==== === 外部资源 === === 历史 === |
英文原版: http://www.disinterest.org/resource/stackless/2.6.4-docs-html/stackless-python.html
Stackless Python
Stackless Python 是Python语言的一个增强版本。它让程序员可以获得基于线程的程序的优点,同时又避免传统线程带来的性能和复杂度问题。Stackless Python为Python语言添加的微线程(microthread)是一种方便、廉价、轻量级的工具,如果使用得当,它不仅可以提供一种构建应用程序或者框架的方法,而且能改进程序的结构和可读性。
如果你在你安装的Python附带的文档中读到这篇文章,这说明你安装的已经是Stackless Python而非标准的Python。
1. 概述
除了Stackless Python新增的功能部分,Stackless Python的其他部分的行为和标准的Python完全一样,用法也完全一样。Stackless的新增的功能,是通过stackless模块暴露出来的框架来使用的。
- stackless — The built-in extension module
- Tasklets — Lightweight threads
- Tasklets, main, current and more
- The tasklet class
- Channels — Communication between tasklets
- Channels and threads
- The channel class
- The scheduler — How tasklets are run
- Cooperative scheduling
- Pre-emptive scheduling
- Exceptions
- Debugging and Tracing — How Stackless differs
- settrace and tasklets
- Threads — Threads and Stackless
- A scheduler per thread
- Channels are thread-safe
- Pickling — Serialisation of running tasklets
- Functions
- Attributes
- Exceptions
- Tasklets — Lightweight threads
2. 你需要知道的
2.1. 阻塞的操作
2.2. 异常
2.3. 调试
3. 外部资源