Steven Bethard <[EMAIL PROTECTED]> writes:

> Peter Dembinski wrote:
>>class A:
>>    def __init__(self, a, b, c, d):
>>        initial = {'a' : a, 'b' : b, 'c' : c, 'd' : d}
>>        for param in initial.keys():
>>            exec "self.%s = initial['%s']" % (param, param)
>
> This is not a good use case for exec.  Use setattr:

OK, true.
>From the other side: what are the usual uses of 'exec'?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to