Hard to understand 'eval'
fc14301589 at icqmail.com
Mon Jun 16 03:12:39 CEST 2008
On 01:15, lunedì 16 giugno 2008 Calvin Spealman wrote:
> such as getattr(obj,
> methname)(a, b, c). Does this make sense?
This is big enlightenment :) Thank you! :)
I found problem with eval() when it comes to pass quoted strings.
I circumvent that by encapsulating the strings in variable or tuple.
The principle is to have a name which will refers a function somewhere in the
program and to call that function, plus additional data passed in.
In other word I'd expect something:
function_list= ['add' ,'paint', 'read']
for func in function_list:
I tried getattr, and I saw that result. I only investigate a little, so I
still have a small perplexity.
Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html
More information about the Python-list