1 public class TestJoin { 2 public static void main(String[] args) { 3 MyThread2 t1 = new MyThread2("abcde"); 4 t1.start(); 5 try { 6 ...
分类:
编程语言 时间:
2015-05-11 23:42:37
阅读次数:
261
Problem DescriptionA simple mathematical formula for e iswhere n is allowed to go to infinity. This can actually yield very accurate approximations o....
分类:
其他好文 时间:
2015-05-11 17:42:01
阅读次数:
100
一、函数函数的作用:可以计算出一个返回值,最大化代码重用,最小化代码冗余,流程的分解。1、函数相关的语句和表达式语句 例子Calls myfunc(‘diege','eggs',meat=‘lit’) #使用函数def,return,yield def adder(a,b=1,*c): ret...
分类:
编程语言 时间:
2015-05-09 01:17:58
阅读次数:
162
import scrapyfrom myproject.items import MyItemclass MySpider(scrapy.Spider):name = ’example.com’ allowed_domains = [’example.com’] start_urls = [ ...
分类:
其他好文 时间:
2015-05-03 20:27:36
阅读次数:
170
在前两篇文章中,我们介绍了什么是Generator和coroutine,在这一片文章中,我们会介绍coroutine在模拟pipeline(管道 )和控制Dataflow(数据流)方面的运用。coroutine可以用来模拟pipeline行为。通过把多个coroutine串联在一起来实现pipe,在...
分类:
编程语言 时间:
2015-05-02 20:45:21
阅读次数:
299
tornado中的协程是如何工作的本文将按以下结构进行组织,说明tornado中协程的执行原理
协程定义
生成器和yield语义
Future对象
ioloop对象
函数装饰器coroutine
总结
协程定义
Coroutines are computer program components that generalize subroutines for nonpreemptive mult...
分类:
其他好文 时间:
2015-05-02 06:20:14
阅读次数:
1046
coroutine一般翻译过来就是协程,类似于线程可以切换,而跟线程是由操作系统调度器来实现切换不一样,协程由用户程序自己调度进行切换。我以前也看过协程相关的内容,但没有自己去实现过。最近搞OpenStack,OpenStack各个模块都是单线程模型,但是用了eventlet的绿色线程,eventlet也是Python的协程实现库。这篇文章我并不打算剖析Python协程库的实现,而是分析一个基于L...
分类:
其他好文 时间:
2015-04-27 10:05:44
阅读次数:
1486
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Itcast.Mall.ConsoleApp{ class Program { stati...
分类:
其他好文 时间:
2015-04-26 15:05:06
阅读次数:
108
原创作品,转载请注明出处:点我上一篇文章Python高级编程之生成器(Generator)与coroutine(一):Generator中,我们介绍了什么是Generator,以及写了几个使用Generator Function的示例,这一小节,我们会介绍Python的coroutine,以及会有一...
分类:
编程语言 时间:
2015-04-25 19:32:56
阅读次数:
140
IEnumerator/ IEnumerablepublic interface IEnumerable
{
IEnumerator GetEnumerator();
}
public interface IEnumerator
{
bool MoveNext();
void Reset();
Object Curre...
分类:
编程语言 时间:
2015-04-20 14:55:26
阅读次数:
309