What does Python fix?

Courageous jkraska at san.rr.com
Thu Jan 24 22:08:14 EST 2002


>But (unlike the unnamed lambda-forms) named code blocks are unable to 
>access the local variables of some other code block.

Java achieves this through inner classes and anonymous classes. While
no approach is superior, this approach has some goodness to it and is
worth considering, I think. While I'm not up to speed on what is or
isn't legal Python in this respect, a trial run in the interpreter
reveals to me that, while a class can be defined within a class in
Python, the inner class doesn't have access to the outer class' scope.
Maybe this should be looked at again?

Tim's certainly right about the anonymous lambda form as far as I can
tell, however. For example, I've seen many a lambda form in lisp which
_could_ be reused but obviously never will. Further, when I see
extensive use of the lambda form, I _usually_ also see a program which
suffers from diarrhea of the keyboard. Things could be organized better,
often enough.

C//




More information about the Python-list mailing list