Help with dict and iter

andrew cooke andrew at acooke.org
Sun Mar 29 18:00:38 CEST 2009


mattia wrote:
>[i wrote]:
>> don't you just want to have a new job machine?
>>
>> for job_list in job_list_list:
>>   job_machine = dict((x+1, iter(JOBS[x])) for x in range(NJOBS)) for x
>>   in job_list:
>>     print(next(job_machine[x]))

ok - btw you can probably simplify the code.

this might work:

job_machine = list(map(iter, JOBS))

andrew

[...]
> Well, you are right, just creating every time a new dict is a good
> solution, I was just adding complexity to a simple problem, thanks.





More information about the Python-list mailing list