On Thu, Dec 2, 2010 at 1:23 AM, Stef Mientki <[email protected]> wrote:
> that doesn't return a table variable, but a string,
> so maybe you want
> return eval ( 'db4' + 'arraydata_table')
Don't use eval. It's evil! :)
'db4' doesn't have to be a string. I think you can access the tables
using subscript notation:
db4['tablename']
Here's the code I posted earlier with modifications:
def table_builder(e, p):
if e == 'inverter':
if p == 0:
t = 'arraydata_table'
elif p == 1:
t = 'array_mins'
else:
t = '%smins' % period
return db4[t]
--
Branko Vukelić
[email protected]
[email protected]
Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny
Gimp Brushmakers Guild
http://bit.ly/gbg-group