Re: best cumulative sum
- From: Peter Otten <__peter__@xxxxxx>
- Date: Sat, 26 Nov 2005 09:18:58 +0100
David Isaac wrote:
> "Peter Otten" <__peter__@xxxxxx> wrote in message
> news:dm3uj4$kko$02$1@xxxxxxxxxxxxxxxxxxxx
>> I'd rather have a second look whether the test is really needed.
>
> That's too obscure of a hint.
> Can you be a bit more explicit?
> Here's an example (below).
> You're saying I think that most of it is unnecessary.
>From the Zen of Python:
"Special cases aren't special enough to break the rules."
I think that the test for an empty iterator makes ireduce() unintuitive. Try
asking someone who has not followed the discussion
what list(ireduce(add, [], 42)) might produce, given that
list(ireduce(add, [1], 42)) --> [43]
list(ireduce(add, [1, 2], 42)) --> [43, 45]
list(ireduce(add, [])) --> []
list(ireduce(add, [1])) --> [1]
list(ireduce(add, [1, 2])) --> [1, 3]
I suspect that [42] will be a minority vote.
Peter
.
- Follow-Ups:
- Re: best cumulative sum
- From: David Isaac
- Re: best cumulative sum
- References:
- best cumulative sum
- From: David Isaac
- Re: best cumulative sum
- From: Micah Elliott
- Re: best cumulative sum
- From: Erik Max Francis
- Re: best cumulative sum
- From: bonono@xxxxxxxxx
- Re: best cumulative sum
- From: David Isaac
- Re: best cumulative sum
- From: Colin J. Williams
- Re: best cumulative sum
- From: David Isaac
- Re: best cumulative sum
- From: Michael Spencer
- Re: best cumulative sum
- From: bonono@xxxxxxxxx
- Re: best cumulative sum
- From: David Isaac
- Re: best cumulative sum
- From: Peter Otten
- Re: best cumulative sum
- From: David Isaac
- Re: best cumulative sum
- From: Peter Otten
- Re: best cumulative sum
- From: David Isaac
- Re: best cumulative sum
- From: Peter Otten
- Re: best cumulative sum
- From: David Isaac
- best cumulative sum
- Prev by Date: Re: Hello World-ish
- Next by Date: Re: wxPython Licence vs GPL
- Previous by thread: Re: best cumulative sum
- Next by thread: Re: best cumulative sum
- Index(es):
Relevant Pages
|