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


Groups > comp.lang.python > #50470

Re: xslice idea | a generator slice

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 2013-07-11 12:00 -0600
Subject Re: xslice idea | a generator slice
Newsgroups comp.lang.python
Message-ID <mailman.4599.1373565668.3114.python-list@python.org> (permalink)

Show all headers | 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