[Python-Dev] PEP 246: lossless and stateless (original) (raw)
Simon Percivall s.percivall at chello.se
Sat Jan 15 22:48:17 CET 2005
- Previous message: [Python-Dev] PEP 246: lossless and stateless
- Next message: [Python-Dev] PEP 246: lossless and stateless
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2005-01-15, at 18.06, Phillip J. Eby wrote:
At 05:32 PM 1/15/05 +0100, Just van Rossum wrote:
Phillip J. Eby wrote:
> >It's not at all clear to me that "sticky" behavior is the best > >default behavior, even with implicit adoptation. Would anyone in > >their right mind expect the following to return [0, 1, 2, 3, 4, 5] > >instead of [0, 1, 2, 0, 1, 2]? > > > > >>> from itertools import * > > >>> seq = range(10) > > >>> list(chain(islice(seq, 3), islice(seq, 3))) > > [0, 1, 2, 0, 1, 2] > > >>> > > I don't understand why you think it would. What does islice have to > do with adaptation? islice() takes an iterator, yet I give it a sequence. No, it takes an iterable, both practically and according to its documentation:
But it does perform an implicit adaptation, via PyObject_GetIter. A list has no next()-method, but iter(list()) does.
//Simon
- Previous message: [Python-Dev] PEP 246: lossless and stateless
- Next message: [Python-Dev] PEP 246: lossless and stateless
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]