On Aug 15, 4:19 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > If you want to simplify things somewhat you can merge the two loops into > one: > > numbers = [12.5, 25, 12.5] > accu = Material(numbers[0]) > for x in numbers[1:]: > accu += Material(x) > period = Slab(accu)
Better to use the `sum' builtin and a generator expression: period = Slab(sum(Material(x)) for x in numbers) -- Roberto Bonvallet -- http://mail.python.org/mailman/listinfo/python-list