Re: Help me abstract this (and stop me from using eval)

2012-10-03 Thread Daniel Klein
On Wednesday, October 3, 2012 5:40:12 PM UTC+1, Daniel Klein wrote: > Thank you Steven! That was PRECISELY what I was looking for. (And kwpolska!) -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me abstract this (and stop me from using eval)

2012-10-03 Thread Daniel Klein
Thank you Steven! That was PRECISELY what I was looking for. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me abstract this (and stop me from using eval)

2012-10-03 Thread Steven D'Aprano
On Wed, 03 Oct 2012 09:23:03 -0700, Daniel Klein wrote: > So ideally I would tell the script which language I'm currently > importing and based on that it would write to the appropriate text > fields. But I don't know how to abstract this: > > tempmes.polish = row[1] > > Well, I do. Like this: >

Re: Help me abstract this (and stop me from using eval)

2012-10-03 Thread Kwpolska
On Wed, Oct 3, 2012 at 6:23 PM, Daniel Klein wrote: > tempmes.polish = row[1] > > Well, I do. Like this: > > eval("tempmes." + language + " = row[1]") > > But... eval is evil, no? There's got to be a better way? > -- > http://mail.python.org/mailman/listinfo/python-list Easy. tempmes = myissue.n