Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #50470

Re: xslice idea | a generator slice

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.048
X-Spam-Evidence '*H*': 0.90; '*S*': 0.00; 'builtin': 0.09; 'iterate': 0.09; 'ah,': 0.16; 'benjamin': 0.16; 'sequence,': 0.16; 'skipped': 0.16; 'subject:generator': 0.16; 'think.': 0.16; 'elements': 0.16; 'wrote:': 0.18; 'module': 0.19; 'trying': 0.19; 'thu,': 0.19; 'input': 0.22; '(or': 0.24; "i've": 0.25; 'second': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'start,': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'could': 0.34; 'point.': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'step': 0.37; 'implement': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'negative': 0.60; 'course': 0.61; 'july': 0.63; 'more': 0.64; 'jul': 0.74; 'oscar': 0.84; 'studying': 0.84; 'mistake': 0.91; '2013': 0.98
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:content-transfer-encoding; bh=eyewNNT0PizMayfB5tpAinxHuw+Ws/uFowySWtPBi38=; b=lnZL5xD7pOoFSVRk4OLsTwnBoxHZ+rC8gbyb2jgyR3AyB0IwDUyejOji5PmiN6MTvb U7AqpmCh/BHH4Y4m6jiddNEw2wLl9l/ve5s8ndtkRFsDHKDYd+3DpH9dI13TIYsJR9uD yprGyOOq+Fn/OHDECSIRGfPayLBx+z7Y9+WtkCsucg1iCafwTDLR1Ndtnt/O7LAq0DCx rfN4Zxp/7/fDmgEF+b1Gbdi8XXQwXRKt0JFM3x28BKLy20H7MJPE0LvX9wrsQnEGUyZw W/cc2mQjTcA9Nk4awCVIzKLXLBNNl9ioWaFkMBS1MvjvRVFR1OocTsgI6p91ccRdfd75 /NTw==
X-Received by 10.66.145.34 with SMTP id sr2mr1493353pab.94.1373565657750; Thu, 11 Jul 2013 11:00:57 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CAHVvXxSDQwk1KVLETetOz5EiNK3BjTD=6px_L9SFfcpfbhuYzA@mail.gmail.com>
References <4a81b6a6-023e-4d47-9bd0-bbc0516caf6b@googlegroups.com> <c087829a-8e30-4f50-afb9-d28a779932e3@googlegroups.com> <mailman.4590.1373555714.3114.python-list@python.org> <56736add-f372-4245-9f50-076b3d44bb00@googlegroups.com> <CAHVvXxSDQwk1KVLETetOz5EiNK3BjTD=6px_L9SFfcpfbhuYzA@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 11 Jul 2013 12:00:17 -0600
Subject Re: xslice idea | a generator slice
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4599.1373565668.3114.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1373565668 news.xs4all.nl 15927 [2001:888:2000:d::a6]:42742
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:50470

Show key headers only | View raw


On Thu, Jul 11, 2013 at 10:34 AM, Oscar Benjamin
<oscar.j.benjamin@gmail.com> wrote:
> On 11 July 2013 17:21, Russel Walker <russ.pobox@gmail.com> wrote:
>> To confess, this is the second time I've made the mistake of trying to implement generator like functionality of a builtin when there already is on in itertools. Need to start studying that module abit more I think. I'm looking at the docs now and I see there are actually a couple of isomethings().
>
> Your xslice (or mine) would still be better than islice when the step
> size is large; islice has to iterate over all the skipped elements
> which could be wasteful if the input is indexable. Also islice doesn't
> support negative values for start, stop or step which xslice does.

Ah, that's an interesting point.  Of course the corollary to that is
that xslice requires a sequence, not just an iterable.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

xslice idea | a generator slice Russel Walker <russ.pobox@gmail.com> - 2013-07-11 07:52 -0700
  Re: xslice idea | a generator slice Russel Walker <russ.pobox@gmail.com> - 2013-07-11 07:54 -0700
    Re: xslice idea | a generator slice Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-07-11 16:14 +0100
      Re: xslice idea | a generator slice Russel Walker <russ.pobox@gmail.com> - 2013-07-11 09:21 -0700
        Re: xslice idea | a generator slice Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-07-11 17:34 +0100
        Re: xslice idea | a generator slice Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-11 12:00 -0600
        Re: xslice idea | a generator slice Fábio Santos <fabiosantosart@gmail.com> - 2013-07-11 20:58 +0100
        Re: xslice idea | a generator slice Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-11 15:02 -0600
  Re: xslice idea | a generator slice Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-11 10:16 -0600

csiph-web