Andrew Berg wrote:
On 5/24/2012 8:59 PM, Dave Angel wrote:
so I fixed that, and got
inconsistent use of tabs and spaces in indentation
because you mistakenly used tabs for indentation.
Not to start another tabs-vs.-spaces discussion, but tabs are perfectly
legal indentation in Python. Tha
Andrew Berg wrote:
On 5/24/2012 8:59 PM, Dave Angel wrote:
so I fixed that, and got
inconsistent use of tabs and spaces in indentation
because you mistakenly used tabs for indentation.
Not to start another tabs-vs.-spaces discussion,
Too late, the seeds of war have been planted
On 05/24/2012 10:27 PM, Andrew Berg wrote:
> On 5/24/2012 8:59 PM, Dave Angel wrote:
>> so I fixed that, and got
>> inconsistent use of tabs and spaces in indentation
>>
>> because you mistakenly used tabs for indentation.
> Not to start another tabs-vs.-spaces discussion, but tabs are perfect
On 5/24/2012 8:59 PM, Dave Angel wrote:
> so I fixed that, and got
> inconsistent use of tabs and spaces in indentation
>
> because you mistakenly used tabs for indentation.
Not to start another tabs-vs.-spaces discussion, but tabs are perfectly
legal indentation in Python. That exception is
On 05/24/2012 09:23 PM, SherjilOzair wrote:
> def adder():
> s = 0
> def a(x):
> s += x
> return sum
> return a
>
> pos, neg = adder(), adder()
> for i in range(10):
> print pos(i), neg(-2*i)
>
> This should work, right? Why does it not?
>
Guess that dep
On Thu, May 24, 2012 at 6:23 PM, SherjilOzair wrote:
> def adder():
> s = 0
> def a(x):
Add a "nonlocal s" declaration right here.
See http://www.python.org/dev/peps/pep-3104/
> s += x
> return sum
> return a
>
> pos, neg = adder(), adder()
> for i in r
On Thu, 24 May 2012 18:23:18 -0700, SherjilOzair wrote:
> def adder():
> s = 0
> def a(x):
> s += x
> return sum
> return a
I think you mean "return s", not sum.
> This should work, right? Why does it not?
No, it shouldn't. When you have an assignment, suc
On 25/05/2012 02:23, SherjilOzair wrote:
def adder():
s = 0
def a(x):
s += x
return sum
return a
pos, neg = adder(), adder()
for i in range(10):
print pos(i), neg(-2*i)
This should work, right? Why does it not?
Checkout slide no. 37 of a
def adder():
s = 0
def a(x):
s += x
return sum
return a
pos, neg = adder(), adder()
for i in range(10):
print pos(i), neg(-2*i)
This should work, right? Why does it not?
Checkout slide no. 37 of a Tour of Go to know inspiration. Just wanted