Dennis Lee Bieber 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
On Wed, Sep 29, 2010 at 7:06 PM, Paul Rubin 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:
>
> http://en.wikibooks.org/wiki/Haskell/List_processing#Scans
>
> Pytho
kj 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 the
> standard li
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 cl
In Terry Reedy
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
>print(list(cusum(s)))
> >>>
>[1, 3, 6, 10, 15, 21]
Actually, th
In article kj wrote:
>The following attempt to get a list of partial sums fails:
>
s = 0
[((s += t) and s) for t in range(1, 10)]
> File "", line 1
>[((s += t) and s) for t in range(1, 10)]
> ^
>SyntaxError: invalid syntax
>
>What's the best way to get a list of partial s
On 9/28/2010 6:57 PM, kj wrote:
The following attempt to get a list of partial sums fails:
s = 0
[((s += t) and s) for t in range(1, 10)]
File "", line 1
[((s += t) and s) for t in range(1, 10)]
^
SyntaxError: invalid syntax
What's the best way to get a list of partial su
On Tue, Sep 28, 2010 at 4:57 PM, kj wrote:
>
>
> The following attempt to get a list of partial sums fails:
>
> >>> s = 0
> >>> [((s += t) and s) for t in range(1, 10)]
> File "", line 1
>[((s += t) and s) for t in range(1, 10)]
> ^
> SyntaxError: invalid syntax
>
Because in Python
On 2010-09-28, Gary Herron wrote:
> Python does have "s+=t" as a statement, and it does have list
> comprehensions [... for ...] as expressions, but you cannot put a
> statement inside an expression.
I've inferred that, in Python, all assignments are by definition
statements, rather than expre
On 28/09/2010 23:57, kj wrote:
The following attempt to get a list of partial sums fails:
s = 0
[((s += t) and s) for t in range(1, 10)]
File "", line 1
[((s += t) and s) for t in range(1, 10)]
^
SyntaxError: invalid syntax
What's the best way to get a list of partial sum
On 9/28/2010 3:57 PM kj said...
The following attempt to get a list of partial sums fails:
s = 0
[((s += t) and s) for t in range(1, 10)]
File "", line 1
[((s += t) and s) for t in range(1, 10)]
^
SyntaxError: invalid syntax
What's the best way to get a list of partial su
On 09/28/2010 03:57 PM, kj wrote:
The following attempt to get a list of partial sums fails:
s = 0
[((s += t) and s) for t in range(1, 10)]
File "", line 1
[((s += t) and s) for t in range(1, 10)]
^
SyntaxError: invalid syntax
What's the best way to get a lis
The following attempt to get a list of partial sums fails:
>>> s = 0
>>> [((s += t) and s) for t in range(1, 10)]
File "", line 1
[((s += t) and s) for t in range(1, 10)]
^
SyntaxError: invalid syntax
What's the best way to get a list of partial sums?
TIA!
kj
--
http://mail.p
13 matches
Mail list logo