So, what is the conclusion? I also think reversed(enumerate(some_seq)) will be
very useful in many cases.
It should:
1) work the same as reversed(tuple(enumerate(...))) for "reversible" objects as
argument of enumerate,
2) raise TypeError if the object is not reversible.
Or, another option would
I've seen this proposed here before. The general idea is that some
iterator transformations (like enumerate) should return sequences when
they're applied to sequences. I think it's good idea, but it adds
complexity and work, which I guess needs to be justified on a case-by-case
basis.
In sho
On Fri, Jan 22, 2021 at 5:21 AM Neil Girdhar wrote:
>
> I've seen this proposed here before. The general idea is that some iterator
> transformations (like enumerate) should return sequences when they're applied
> to sequences. I think it's good idea, but it adds complexity and work, which
>
On Thu, Jan 21, 2021 at 1:26 PM Chris Angelico wrote:
>
> On Fri, Jan 22, 2021 at 5:21 AM Neil Girdhar wrote:
> >
> > I've seen this proposed here before. The general idea is that some
> > iterator transformations (like enumerate) should return sequences when
> > they're applied to sequences.
On Fri, Jan 22, 2021 at 5:44 AM Neil Girdhar wrote:
>
> On Thu, Jan 21, 2021 at 1:26 PM Chris Angelico wrote:
> >
> > On Fri, Jan 22, 2021 at 5:21 AM Neil Girdhar wrote:
> > >
> > > I've seen this proposed here before. The general idea is that some
> > > iterator transformations (like enumerat
On Thu, Jan 21, 2021 at 10:43 AM Neil Girdhar wrote:
> > > I've seen this proposed here before. The general idea is that some
> iterator transformations (like enumerate) should return sequences when
> they're applied to sequences.
I'm not so sure -- I don't think I want a sequence returned. In
On Thu, Jan 21, 2021 at 3:13 PM Christopher Barker wrote:
>
> On Thu, Jan 21, 2021 at 10:43 AM Neil Girdhar wrote:
>>
>> > > I've seen this proposed here before. The general idea is that some
>> > > iterator transformations (like enumerate) should return sequences when
>> > > they're applied t
On Fri, Jan 22, 2021 at 8:31 AM Neil Girdhar wrote:
> It's possible for reversed(enumerate(...)) to just work if enumerate
> of a sequence were to return a sequence view. Then you would also get
> all the other sequence operations for free like enumerate(...)[23:27],
> len(enumerate(...)), etc.
On Thu, Jan 21, 2021, at 18:48, Chris Angelico wrote:
> Note that slicing is NOT easy. The proposed semantics for a reversed
> enumeration would make slicing extremely odd.
What proposed semantics? You were the one who posted a pure-python
implementation that didn't bother to implement slicing.
On Fri, Jan 22, 2021 at 11:10 AM Random832 wrote:
>
> On Thu, Jan 21, 2021, at 18:48, Chris Angelico wrote:
> > Note that slicing is NOT easy. The proposed semantics for a reversed
> > enumeration would make slicing extremely odd.
>
> What proposed semantics? You were the one who posted a pure-pyt
On Thu, Jan 21, 2021 at 7:19 PM Chris Angelico wrote:
>
> On Fri, Jan 22, 2021 at 11:10 AM Random832 wrote:
> >
> > On Thu, Jan 21, 2021, at 18:48, Chris Angelico wrote:
> > > Note that slicing is NOT easy. The proposed semantics for a reversed
> > > enumeration would make slicing extremely odd.
On Fri, Jan 22, 2021 at 11:48 AM Neil Girdhar wrote:
> If enumerate(some_sequence) returns a sequence view, iterating over
> that sequence view does not advance it—just like how DictViews are not
> altered by iteration. Same thing if reversed(some_sequence) returns a
> sequence view.
Then that's
On Thu, Jan 21, 2021, at 19:19, Chris Angelico wrote:
> Yeah, I don't think that'll work if you slice more than once,
> especially with some iteration in between.
I think part of the point of this implementation [or the other person's
suggestion of having a "collection view", which amounts to the
13 matches
Mail list logo