Path: csiph.com!usenet.pasdenom.info!news.franciliens.net!fdn.fr!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.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.045 X-Spam-Evidence: '*H*': 0.91; '*S*': 0.00; '16,': 0.03; 'api.': 0.05; 'referring': 0.07; 'pretend': 0.09; 'python': 0.11; 'coroutines': 0.16; 'iterator': 0.16; 'iterators': 0.16; 'send()': 0.16; 'subject:generator': 0.16; 'throw': 0.16; 'wrote:': 0.18; 'seems': 0.21; "aren't": 0.24; 'mon,': 0.24; 'subject:/': 0.26; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'overhead': 0.31; 'this.': 0.32; 'implemented': 0.33; 'could': 0.34; 'offered': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'implement': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'to:addr:python.org': 0.39; 'free': 0.61; 'skip:* 10': 0.61; "you're": 0.61; 'offer': 0.62; 'happen': 0.63; 'skip:n 10': 0.64; 'mar': 0.68; 'other.': 0.75; 'hand': 0.80; '2015': 0.84; 'protocol,': 0.84; 'replacements': 0.84; 'why?': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=pAfJ+4bkWaXzEDkwCaVriQNAeXAJ/RDblShLM2EFCNk=; b=gmAZYsHThMtnbMGmSfKum0XvwoySU8zXsC+oTlFdr9CmE4LVjWgM8dAtAxM/rjohYR rnebVLcD0a39Dz6VwFCOCc4Sk1utdJCZnqdRzyvOqrPHsSYnNY23NQqN6qSGIC/KQ930 oBVzvPTuwUz4uW5Z0uJWW0mNiMOQlC5xQWQPR7FN1QM62FFrj4G3AeLhPI5Pm4bbdFrL Md2gqi3v7oUmXYNFOSwt+KE/AL81vyzsIsncqOjiCVBeTdd5NtEtBkIYavfcO3InDQ1R 3Vx1qMZ3nFIWf7LxIOiC6KEPNZrjiPTXJtCyrNSelUIczO4co6jkhD+kO8HRIMsugZbG NUSg== X-Received: by 10.70.96.98 with SMTP id dr2mr49452186pdb.96.1426491515363; Mon, 16 Mar 2015 00:38:35 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <87egopmn4z.fsf@elektro.pacujo.net> References: <5501be8b$0$13006$c3e8da3$5496439d@news.astraweb.com> <874mpnp6nv.fsf@elektro.pacujo.net> <87y4mznmj8.fsf@elektro.pacujo.net> <55062bda$0$12998$c3e8da3$5496439d@news.astraweb.com> <87egopmn4z.fsf@elektro.pacujo.net> From: Ian Kelly Date: Mon, 16 Mar 2015 01:37:54 -0600 Subject: Re: generator/coroutine terminology To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1426491518 news.xs4all.nl 2846 [2001:888:2000:d::a6]:36064 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87520 On Mon, Mar 16, 2015 at 1:12 AM, Marko Rauhamaa wrote: > I was actually referring to the offered API. It still seems to me like > all iterators could offer close(), send() and throw(). Why? To make all > iterators drop-in replacements of each other. The purpose of close, send and throw is to implement *coroutines*, not iterators. The fact that coroutines in Python happen to be implemented as a type of iterator doesn't mean that all iterators need to have them. You're free to add these methods to non-generator iterators that you write in order to create iterators that pretend to be coroutines, but I'm having a hard time seeing what purpose would be served by this. If on the other hand these methods were to be added to the iterator protocol, it would just create unnecessary implementation overhead for the 99.99% of non-generator iterators that are under no illusions about the fact that they aren't coroutines.