George Sakkis <[EMAIL PROTECTED]> writes:
> On May 31, 4:19 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
>> Cameron <[EMAIL PROTECTED]> writes:
>> > I was reading this http://www.paulgraham.com/icad.html";>Paul
>> > Graham article and he builds an accumuator generator function in
>> > the appen
On May 31, 4:19 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
> Cameron <[EMAIL PROTECTED]> writes:
> > I was reading this http://www.paulgraham.com/icad.html";>Paul
> > Graham article and he builds an accumuator generator function in
> > the appendix. His looks like this:
>
> >
> > def foo(n):
Cameron <[EMAIL PROTECTED]> writes:
> I was reading this http://www.paulgraham.com/icad.html";>Paul
> Graham article and he builds an accumuator generator function in
> the appendix. His looks like this:
>
>
> def foo(n):
> s = [n]
> def bar(i):
> s[0] += i
> return s[0]
> return ba
Cameron wrote:
On May 30, 1:04 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
Cameron schrieb:
I was reading this http://www.paulgraham.com/icad.html";>Paul
Graham article and he builds an accumuator generator function in
the appendix. His looks like this:
def foo(n):
s = [n]
def bar
On May 30, 1:04 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> Cameron schrieb:
>
>
>
> > I was reading this http://www.paulgraham.com/icad.html";>Paul
> > Graham article and he builds an accumuator generator function in
> > the appendix. His looks like this:
>
> >
> > def foo(n):
> > s = [
At 2008-05-30T19:50:43Z, Cameron <[EMAIL PROTECTED]> writes:
> Why does that work, but not this:
>
> def foo(n):
> s = n
> def bar(i):
> s += i
> return s
> return bar
Assume that n is an int, making s one also. Ints are immutable; you can
only copy them. So your bar is taking s,
Cameron schrieb:
I was reading this http://www.paulgraham.com/icad.html";>Paul
Graham article and he builds an accumuator generator function in
the appendix. His looks like this:
def foo(n):
s = [n]
def bar(i):
s[0] += i
return s[0]
return bar
Why does that work, but not this: