On 06.03.2016 19:51, Tim Chase wrote:
So it looks like one needs to either
results = reversed(list(zip(...)))
or, more efficiently (doing it with one less duplication of the list)
results = list(zip(...))
results.reverse()
Nice idea. :) Unfortunately, I used it while drafting som
On 06.03.2016 19:53, Peter Otten wrote:
Sven R. Kunze wrote:
what's the reason that reversed(zip(...)) raises as a TypeError?
Would allowing reversed to handle zip and related functions lead to
strange errors?
In Python 3 zip() can deal with infinite iterables -- what would you expect
from
r
On 2016-03-06 18:29, Sven R. Kunze wrote:
Hi,
what's the reason that reversed(zip(...)) raises as a TypeError?
Would allowing reversed to handle zip and related functions lead to
strange errors?
'reversed' yields the items in reverse order; it needs the last item first.
Iterators yield items
Tim Chase wrote:
> On 2016-03-06 19:29, Sven R. Kunze wrote:
>> what's the reason that reversed(zip(...)) raises as a TypeError?
>>
>> Would allowing reversed to handle zip and related functions lead to
>> strange errors?
>
> Peculiar, as this works in 2.x but falls over in 3.x:
>
> $ python
>
On 2016-03-06 12:38, Tim Chase wrote:
> On 2016-03-06 19:29, Sven R. Kunze wrote:
> > what's the reason that reversed(zip(...)) raises as a TypeError?
>
> I'm not sure why reversed() doesn't think that the thing returned by
> zip() isn't a sequence.
Ah, a little more digging suggests that in 2.x,
Sven R. Kunze wrote:
> what's the reason that reversed(zip(...)) raises as a TypeError?
>
> Would allowing reversed to handle zip and related functions lead to
> strange errors?
In Python 3 zip() can deal with infinite iterables -- what would you expect
from
reversed(zip(count()))
?
If all
d(zip(ten, ten))
>>> list(reversed(zip(ten, ten)))
[(9, 9), (8, 8), (7, 7), (6, 6), (5, 5), (4, 4), (3, 3), (2, 2), (1, 1), (0, 0)]
>>>
> To: python-list@python.org
> From: srku...@mail.de
> Subject: reversed(zip(...)) not working as intended
> Date: Sun, 6 Mar 2016 19:2
On 2016-03-06 19:29, Sven R. Kunze wrote:
> what's the reason that reversed(zip(...)) raises as a TypeError?
>
> Would allowing reversed to handle zip and related functions lead to
> strange errors?
Peculiar, as this works in 2.x but falls over in 3.x:
$ python
Python 2.7.9 (default, Mar 1 201
Hi,
what's the reason that reversed(zip(...)) raises as a TypeError?
Would allowing reversed to handle zip and related functions lead to
strange errors?
Best,
Sven
--
https://mail.python.org/mailman/listinfo/python-list