Re: Is the behavior expected?

2008-11-27 Thread Michele Simionato
On Nov 27, 10:11 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > Michele Simionato wrote: > > Guido and the Common Lisp implementors are happy with mutating the loop > > index. I myself prefer the functional way. > > I'd agree with you, except Python doesn't provide any

Re: Is the behavior expected?

2008-11-27 Thread Lawrence D'Oliveiro
Michele Simionato wrote: > Guido and the Common Lisp implementors are happy with mutating the loop > index. I myself prefer the functional way. I'd agree with you, except Python doesn't provide any way to create user-defined constants, so constant loop indices have no precedent. -- http://mail.p

Re: Is the behavior expected?

2008-11-26 Thread Alphones
all the discussions are very helpful to me. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is the behavior expected?

2008-11-26 Thread Alphones
On 11月27日, 上午12时07分, Peter Otten <[EMAIL PROTECTED]> wrote: > Alphones wrote: > > On 11月26日, 下午9时28分, [EMAIL PROTECTED] wrote: > >> Alphones: > > >> > it is a little deferent from other script language. > > >> See also here:http://en.wikipedia.org/wiki/Dynamic_scope#Dynamic_scoping > > >> Python do

Re: Is the behavior expected?

2008-11-26 Thread Michele Simionato
On Nov 26, 2:28 pm, [EMAIL PROTECTED] wrote: > Alphones: > > > it is a little deferent from other script language. > > See also here:http://en.wikipedia.org/wiki/Dynamic_scope#Dynamic_scoping > > Python doesn't have such automatic closures, probably for performance > reasons and/or maybe to keep it

Re: Is the behavior expected?

2008-11-26 Thread Peter Otten
Alphones wrote: > On 11月26日, 下午9时28分, [EMAIL PROTECTED] wrote: >> Alphones: >> >> > it is a little deferent from other script language. >> >> See also here:http://en.wikipedia.org/wiki/Dynamic_scope#Dynamic_scoping >> >> Python doesn't have such automatic closures, probably for performance >> reas

Re: Is the behavior expected?

2008-11-26 Thread Diez B. Roggisch
Alphones wrote: > On 11月26日, 下午9时28分, [EMAIL PROTECTED] wrote: >> Alphones: >> >> > it is a little deferent from other script language. >> >> See also here:http://en.wikipedia.org/wiki/Dynamic_scope#Dynamic_scoping >> >> Python doesn't have such automatic closures, probably for performance >> reas

Re: Is the behavior expected?

2008-11-26 Thread Alphones
On 11月26日, 下午9时28分, [EMAIL PROTECTED] wrote: > Alphones: > > > it is a little deferent from other script language. > > See also here:http://en.wikipedia.org/wiki/Dynamic_scope#Dynamic_scoping > > Python doesn't have such automatic closures, probably for performance > reasons and/or maybe to keep it

Re: Is the behavior expected?

2008-11-26 Thread bearophileHUGS
Alphones: > it is a little deferent from other script language. See also here: http://en.wikipedia.org/wiki/Dynamic_scope#Dynamic_scoping Python doesn't have such automatic closures, probably for performance reasons and/or maybe to keep its C implementation simpler (maybe other people here can gi

Re: Is the behavior expected?

2008-11-26 Thread Alphones
On 11月26日, 下午8时48分, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Alphones wrote: > > Hi all, > > > def getFunc(x): > > return lambda y : x + y > > > if __name__ == '__main__': > > todo = [] > > proc = getFunc(1) > > todo.append(lambda: proc(1)) > > proc = getFunc(2) > > t

Re: [lambda]Is the behavior expected?

2008-11-26 Thread Diez B. Roggisch
Alphones wrote: > Hi all, > > > def getFunc(x): > return lambda y : x + y > > if __name__ == '__main__': > todo = [] > proc = getFunc(1) > todo.append(lambda: proc(1)) > proc = getFunc(2) > todo.append(lambda: proc(1)) > proc = getFunc(3) > todo.append(lambda: pr

[lambda]Is the behavior expected?

2008-11-26 Thread Alphones
Hi all, def getFunc(x): return lambda y : x + y if __name__ == '__main__': todo = [] proc = getFunc(1) todo.append(lambda: proc(1)) proc = getFunc(2) todo.append(lambda: proc(1)) proc = getFunc(3) todo.append(lambda: proc(1)) todo.append(lambda: getFunc(1)(1)