Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Jason Swails Newsgroups: comp.lang.python Subject: Re: Why generators take long time? Date: Tue, 19 Jan 2016 15:25:44 -0500 Lines: 21 Message-ID: References: <1e092318-5052-4383-aabe-dd979d72645d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de 4AVNHEjuxHormZQ1Bnt0NAapUKOPR5Xwygu9+wwQyVcw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'expressions': 0.07; 'received:209.85.213.46': 0.07; 'cc:addr:python-list': 0.09; 'subject:Why': 0.09; 'jan': 0.11; '2016': 0.16; 'cc:name:python list': 0.16; 'decent': 0.16; 'iteration': 0.16; 'iterator': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'email addr:gmail.com>': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'forgot': 0.23; 'header:In-Reply- To:1': 0.24; '(which': 0.26; 'message-id:@mail.gmail.com': 0.27; 'tue,': 0.34; 'received:google.com': 0.35; 'jason': 0.35; 'subject:time': 0.35; 'received:209.85': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'thought': 0.37; 'received:209': 0.38; 'where': 0.40; 'some': 0.40; 'chance': 0.60; 'here.': 0.62; 'subject:long': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=+1b5fHTvNRC3Ko0jf59i5qrQKOY2B/kxQgq87DWvNGI=; b=b7Eo2R5eXy6sK5fbdxFNNMyh83fzProzdbSZH1RGKJPmzf6airq2hShVyHDZntWyJZ 3SYnPDYpUDIPeXATIrK1enmq9uo8Lk4bUXIF80dR0Zrsoq5RIqr3YQPACw7qlpSlhGOZ +hgG6WC3CYIsco8hwPjB99nH8F4ZwJ73nzunkncmqbZyxSxZhJnjEeyLc7MurOlRugoZ fmPEDXC94kTwTu9FC3TniZhkYzSRvSAoenTNVrMlvWZ/P87R/Ug9LIcT3F0e45LTEQwu FCLfEMoqB1tSSgBVnzPhvTMcdlWbSmnmorYgaroPFDP+PSbqQSOsGpkRUBlfr1gVtRnS 9nqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=+1b5fHTvNRC3Ko0jf59i5qrQKOY2B/kxQgq87DWvNGI=; b=XYY04vhQEUqYJoDZhl371ISo5w+UCcMvuLt8C5kiYmZnJnGA2edT921D7ydkLVx3bu xnndxNXtHr8ea3CnFNUDpmglyJeIXuhg/rNrDSwzexwFk1GxmaYX+Ml/LY22XAwD3H3U Bnizp+wRGawC/cswEZ1prjg0ThxMGGJD/9rpcbTLzSEX1tdjA7ByEo2QgLqdy4BQvyaX 7UgbQXbKnGmt+e3lgGP8aKLgqgMwYPpV+k/8cWeC/pD6mIZtke0AxYAhBqXt4pyfbreh xhTISiDfXj8YYCA/RTVbaLTk+Smz7SPKDcMqECAIXESpTenHVo4doFjs+HINWsstT/06 8EMA== X-Gm-Message-State: ALoCoQnotPNPv4tpnEDh9xwhiS9My38lsNY1MD/YZDNsgIz148SQ9g+5/2m64pbtglrN2t3XjVaXvZnQQkFNmeDr23xBsC17UA== X-Received: by 10.31.155.23 with SMTP id d23mr19284244vke.146.1453235144654; Tue, 19 Jan 2016 12:25:44 -0800 (PST) In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.20+ X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:101907 On Tue, Jan 19, 2016 at 3:19 PM, Jason Swails wrote: > > I use generator expressions when > > - I *might* want to > =E2=80=8BI forgot to finish my thought here. I use generator expressions w= hen I don't want to worry about memory, there's a decent chance of short-circuiting=E2=80=8B, or I just want to do some simple iteration where= the iterator will not be the bottleneck (which is almost always). --=20 Jason M. Swails BioMaPS, Rutgers University Postdoctoral Researcher