From: Csaba Henk Date: 2006-07-27T08:25:11+09:00 Subject: Re: For performance, write it in C On 2006-07-26, Sean O'Halpin wrote: > implemented. For example, Ruby has real closures, Python doesn't. I Even if OT, just for the sake of correctness: let me remark that Python does have closures. Local functions (ones defined within another function's body) are scoped lexically. It's just sort of an anti-POLA (and inconvenient, as-is) piece of semantics that variables get reinitalized upon assignment. Hence: def foo(): x = 5 def bar(): x = 6 return x bar() return x, bar x, bar = foo() print x, bar() ==> 5 6 def foo(): _x = [5] def bar(): _x[0] = 6 return _x[0] bar() return _x[0], bar x, bar = foo() print x, bar() ==> 6 6 Regards, Csaba