Supplementing the std lib (Was: partial sums problem)

2010-09-29 Thread kj
In mailman.1142.1285722789.29448.python-l...@python.org Terry Reedy tjre...@udel.edu writes: Do not try to do a reduction with a comprehension. Just write clear, straightforward code that obviously works. s=[1,2,3,4,5,6] def cusum(s): t = 0 for i in s: t += i yield t

Re: Supplementing the std lib (Was: partial sums problem)

2010-09-29 Thread Ethan Furman
kj wrote: I'm interested in reading people's take on the question and their way of dealing with those functions they consider worthy of the standard library.) Well, I have no functions than I'm lobbying to get into the stdlib, but for all those handy-dandy utility functions, decorators, and

Re: Supplementing the std lib (Was: partial sums problem)

2010-09-29 Thread Paul Rubin
kj no.em...@please.post writes: But in the immediate term, cusum is not part of the standard library. Where would you put it if you wanted to reuse it? Do you create a module just for it? Or do you create a general stdlib2 module with all those workhorse functions that have not made it to

Re: Supplementing the std lib (Was: partial sums problem)

2010-09-29 Thread Ian Kelly
On Wed, Sep 29, 2010 at 7:06 PM, Paul Rubin no.em...@nospam.invalid wrote: As for the stdlib, the natural places for such a function would be either itertools or functools, and the function should probably be called scan, inspired by this:

Re: Supplementing the std lib (Was: partial sums problem)

2010-09-29 Thread Paul Rubin
Dennis Lee Bieber wlfr...@ix.netcom.com writes: Python's version would be like scanl with an optional arg to make it like scanl1. Vs APL's expand operator? I'm not familiar with that but maybe it's similar. -- http://mail.python.org/mailman/listinfo/python-list