En Sun, 07 Sep 2008 14:30:09 -0300, Mensanator <[EMAIL PROTECTED]> escribió:
> Actualy, I already get the behaviour I want. sum([1,None]) > throws an exception. I don't see why sum([]) doesn't throw > an exception also (I understand that behaviour is by design, > I'm merely pointing out that the design doesn't cover every > situation). [...] > Exactly. That's why I would prefer sum([]) to raise an > exception instead of giving a false positive. The built in behavior can't be good for every usage. Nobody prevents you from defining yoru own function tailored to your own specs, like this: def strict_sum(items): items = iter(items) try: first = items.next() except StopIteration: raise ValueError, "strict_sum with empty argument" return sum(items, first) Tweak as needed. Based on other posts I believe your Python skills are enough to write it on your own, so I don't see why you're complaining so hard about the current behavior. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list