On Aug 30, 5:30 pm, cnb <[EMAIL PROTECTED]> wrote: > how does doing something twice not change complexity? yes it maybe > belongs to the same complexity-class but is still twice as slow no?
Who is doing something twice? Definitely not sum(). sum() does not create intermediate list, and if you pass generator expressions in it you wouldn't make any intermediate list at all, thus simple looping but in interpreter code. sum() that is passed a list comprehension should be faster for extremely small numbers of values to sum, but we don't care about small things, do we? But using intermediate list should be fast enough for even large numbers of values, the time when it can't cope anymore would be when the intermediate list takes half of your memory (how often is that for regular applications?). -- http://mail.python.org/mailman/listinfo/python-list