News for hackers. Stuff that matters.
Re:JavaScript Needs Blocks by spacemanaki on Tuesday January 10, 2012 @01:45PM (#3448316)
Technically Python has what I like to call "Java closures" (although I admit that is not really fair). In Python the body of an anonymous function (lambda) can only be an expression and the bindings closed over by a named inner function are immutable. You can get around the second limitation with a single element list and this is the same way you get around Java's limitation that a local variable referenced by an anonymous inner class be final.
Re:JavaScript Needs Blocks by narm60 on Tuesday January 10, 2012 @02:27PM (#3448547)
The single element list is no longer necessary w/ Python 3's nonlocal keyword (along w/ the old global keyword)