Re: Sequence iterators with __index__

2008-06-27 Thread yaipa
On Jun 24, 4:19 pm, schickb <[EMAIL PROTECTED]> wrote: > On Jun 24, 3:45 pm, Matimus <[EMAIL PROTECTED]> wrote: > > > > > > I think it would be useful if iterators on sequences had the __index__ > > > method so that they could be used to slice sequences. I was writing a > > > class and wanted to re

Re: Sequence iterators with __index__

2008-06-25 Thread Matimus
On Jun 24, 4:19 pm, schickb <[EMAIL PROTECTED]> wrote: > On Jun 24, 3:45 pm, Matimus <[EMAIL PROTECTED]> wrote: > > > > > > I think it would be useful if iterators on sequences had the __index__ > > > method so that they could be used to slice sequences. I was writing a > > > class and wanted to re

Re: Sequence iterators with __index__

2008-06-25 Thread schickb
On Jun 25, 12:11 am, schickb <[EMAIL PROTECTED]> wrote: > > But this isn't just about slicing. I'd like sequence iterators to be > usable as simple indexes as well; like a[it] (which __index__ would > also provide). It occurred to me that this wouldn't need to be limited to sequence iterators. Alt

Re: Sequence iterators with __index__

2008-06-25 Thread schickb
On Jun 24, 5:46 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > > Wanting to slice while iterating is a *very* specialized usage. I disagree because iterators mark positions, which for sequences are just offsets. And slicing is all about offsets. Here is a quote from the already implemented PEP 357:

Re: Sequence iterators with __index__

2008-06-24 Thread Terry Reedy
schickb wrote: On Jun 24, 3:45 pm, Matimus <[EMAIL PROTECTED]> wrote: I think it would be useful if iterators on sequences had the __index__ method so that they could be used to slice sequences. I was writing a class and wanted to return a list iterator to callers. I then wanted to let caller

Re: Sequence iterators with __index__

2008-06-24 Thread schickb
On Jun 24, 3:45 pm, Matimus <[EMAIL PROTECTED]> wrote: > > > I think it would be useful if iterators on sequences had the __index__ > > method so that they could be used to slice sequences. I was writing a > > class and wanted to return a list iterator to callers.  I then wanted > > to let callers

Re: Sequence iterators with __index__

2008-06-24 Thread Matimus
On Jun 24, 3:29 pm, schickb <[EMAIL PROTECTED]> wrote: > I think it would be useful if iterators on sequences had the __index__ > method so that they could be used to slice sequences. I was writing a > class and wanted to return a list iterator to callers.  I then wanted > to let callers slice from

Sequence iterators with __index__

2008-06-24 Thread schickb
I think it would be useful if iterators on sequences had the __index__ method so that they could be used to slice sequences. I was writing a class and wanted to return a list iterator to callers. I then wanted to let callers slice from an iterator's position, but that isn't supported without creat