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.

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to