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


Groups > comp.lang.python > #50466

Re: xslice idea | a generator slice

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.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 <oscar.j.benjamin@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.035
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'builtin': 0.09; 'iterate': 0.09; 'cc:addr:python-list': 0.11; 'skipped': 0.16; 'subject:generator': 0.16; 'think.': 0.16; 'elements': 0.16; 'wrote:': 0.18; 'module': 0.19; 'trying': 0.19; 'input': 0.22; 'cc:addr:python.org': 0.22; '(or': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'second': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'start,': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'could': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'step': 0.37; 'implement': 0.38; 'negative': 0.60; 'july': 0.63; 'more': 0.64; 'to:addr:gmail.com': 0.65; '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 :cc:content-type:content-transfer-encoding; bh=wc/SpXDUeosyiIXYnu2g8g/SFGzJztpka+RFWPzXx/4=; b=KdydPmRWLFUu31MvEpD3A/xnKKyu/rANac+gFDc568XY8muKZjWtSH+DIZOEXpjurh JW042/8glcihdGwfZab5A+5fkkKp7rIkYzT6HrrZZB+Dp2iFHicOztC1wESJdo8C0w0V 4BESDO1nW5SnIwfTYqkApRt2xZiaAtrlYmSRyh2NN+98Iw98ul0V85gxP9fP5Gm0i/qI 5v9FKZ5P4WhbtQvee6b+WZmBNHyACAUsWVYxBSEIxJBK5HyFIAyxX+KBvXk6DqyVtwaF yHfkriPtNZaXPjYJCl6EF8CI/PdaYfAN/XpHBQwGWcQ715kaSscojmDUR31vf0XPFqmU Z44Q==
X-Received by 10.220.6.135 with SMTP id 7mr22109354vcz.72.1373560493699; Thu, 11 Jul 2013 09:34:53 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <56736add-f372-4245-9f50-076b3d44bb00@googlegroups.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>
From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Date Thu, 11 Jul 2013 17:34:33 +0100
Subject Re: xslice idea | a generator slice
To Russel Walker <russ.pobox@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
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.4597.1373560496.3114.python-list@python.org> (permalink)
Lines 11
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1373560496 news.xs4all.nl 15995 [2001:888:2000:d::a6]:46605
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:50466

Show key headers only | View raw


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.

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