[Numpy-discussion] exec: bad practice?
John [H2O]
washakie@gmail....
Tue Sep 15 06:04:36 CDT 2009
Hello,
I have a bit of code where I create arrays with meaningful names via:
meat = ['beef','lamb','pork']
cut = ['ribs','cutlets']
for m in meat:
for c in cut:
exec("consumed_%s_%s = np.zeros((numxgrid,numygrid,nummeasured))" %
(m,c))
Is this 'pythonic'? Or is it bad practice (and potentially slow) to use the
'exec' statement?
--
View this message in context: http://www.nabble.com/exec%3A-bad-practice--tp25452013p25452013.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
More information about the NumPy-Discussion
mailing list