Fix multiprocessing example when using Python 3
In Python 3, 'map' returns an object which evalutes the function as it is consumed, not when 'map' is called. Therefore, the correct comparison to pool.map(...) is list(map(...)).
This commit is contained in:
parent
7ca9327f7d
commit
6514f7a8e1
1 changed files with 5 additions and 5 deletions
|
|
@ -64,11 +64,11 @@ def serial(mech, predicate, nTemps):
|
|||
P = ct.one_atm
|
||||
X = 'CH4:1.0, O2:1.0, N2:3.76'
|
||||
init_process(mech)
|
||||
y = map(predicate,
|
||||
zip(itertools.repeat(mech),
|
||||
np.linspace(300, 900, nTemps),
|
||||
itertools.repeat(P),
|
||||
itertools.repeat(X)))
|
||||
y = list(map(predicate,
|
||||
zip(itertools.repeat(mech),
|
||||
np.linspace(300, 900, nTemps),
|
||||
itertools.repeat(P),
|
||||
itertools.repeat(X))))
|
||||
return y
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue