Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'function,': 0.07; 'python': 0.09; 'concurrent': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'stackless': 0.09; 'switches': 0.09; "(i'm": 0.16; 'jumping': 0.16; 'message-id:@dough.gmane.org': 0.16; 'modules,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'threads': 0.16; 'wrote:': 0.17; 'examples': 0.18; 'memory': 0.18; 'supposed': 0.21; 'example': 0.23; 'programming': 0.23; 'allows': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'i/o': 0.29; 'function': 0.30; 'could': 0.32; 'to:addr :python-list': 0.33; 'version': 0.34; "can't": 0.34; 'subject:?': 0.35; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'url:org': 0.36; 'uses': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'some': 0.38; 'url:en': 0.38; 'to:addr:python.org': 0.39; 'space': 0.39; 'called': 0.39; 'header:Received:5': 0.40; 'address': 0.60; 'subject:, ': 0.61; 'url:index': 0.61; 'back': 0.62; 'lightweight': 0.84; 'received:89': 0.86; 'officially': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Damjan Subject: Re: why greenlet, gevent or the stackless are needed? Date: Sat, 07 Jul 2012 17:38:53 +0200 References: <456501fb-af2d-4741-9b73-33c65d7f0aa8@t1g2000pbl.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 89.205.110.217 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120616 Thunderbird/13.0.1 In-Reply-To: <456501fb-af2d-4741-9b73-33c65d7f0aa8@t1g2000pbl.googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1341675491 news.xs4all.nl 6953 [2001:888:2000:d::a6]:35090 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25023 On 07.07.2012 09:09, self.python wrote: > (I'm very new to this coroutine part > so It's not supposed to attack these modules, > just I don't know the differences) > > atfer version 2.5, python officially support coroutine with yield. > and then, why greenlet, gevent, Stackless python are still useful? > > it there somthing that "yield" can't do > or just it is easier or powerful? The greenlet site has some very simple examples what it can provide. For example jumping from one function in another, and back http://greenlet.readthedocs.org/en/latest/index.html Gevent then uses greenlet to do lightweight "processes" (greenlets) that are I/O scheduled. This allows for a simple model of programming that scales to a large number of concurrent connections. You could do that with threads but you can't start as many threads as greenlets, since they have a much larger memory address space footprint. There's one function, called the gevent hub, that waits for any I/O event and then switches to the function that "blocked" on that I/O. -- damjan