Leif K-Brooks wrote:
> Steven Bethard wrote:
>>     class A(object):
>>         def _get_sum():
>>             return sum(xrange(10))
>>         sum = _get_sum()
> 
> What's wrong with sum = sum(xrange(10))?

Nothing, except that it probably doesn't answer the OP's question.  The 
OP presented a "silly example":

     class A:
         sum = 0
         for i in range(10):
             sum += i

I assume the intention was to indicate that the initialization required 
multiple statements.  I just couldn't bring myself to write that 
horrible for-loop when the sum() function is builtin. ;)

STeVe
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to