[Tutor] Improving My Simple Game Code for Speed, Memory and Learning
Dave Angel
davea at davea.name
Sun Jan 4 03:57:20 CET 2015
On 01/03/2015 06:10 PM, WolfRage wrote:
> On 01/03/2015 04:42 PM, Dave Angel wrote:
>> self.transposed_grid = list( zip(*self.grid) )
> This results in the same thing with or with out the list() wrapper. Using
> Python 3.4.0 (default, Apr 11 2014, 13:05:11)
> [GCC 4.8.2] on linux
In Python 3, zip() returns an iterator. So you can traverse it once. I
don't believe the second time is guaranteed to be the same. A list is
what you want.
--
DaveA
More information about the Tutor
mailing list