By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,767 Members | 2,114 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,767 IT Pros & Developers. It's quick & easy.

Shed my a light :)

P: n/a
Hi,
I using eval for quite strange reason, as long as I don't know a different
way to implement.

An example:

actions= ('print', 'sum', 'divide', 'myfunction')
parameters=(5, 'nothing',5.63, object)

for routines in actions:
routines(parameters)

I'd like to note that actions are string or string expressions of the program
functions or python itself, so I've in my program something like:

for nn in actions:
eval('cp.%s' %nn)

Where cp is an instance.

So I'm asking here whether exist a way that these string become functions
inside my program, without using eval()

--
Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html
Jun 2 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.