Python for the win!
Kidding aside, it's generally a good idea to use as high level library functions as possible, e.g. in my case use itertools to create and iterate the list, rather than doing things manually. If you have a problem, you can bet someone already had a similar one, AND came up with a quicker solution than you would in 15 minutes
(But my code also allows for partitioning - so I can say give me any range by count, for splitting across several GPUs or instances)