any trick to allow anonymous code blocks in python?

Paul McGuire ptmcg at austin.stopthespam_rr.com
Sat Jun 26 12:54:27 CEST 2004


>  Maybe this relates to the fact that GUI toolkits are mostly C/C++
> based, and that years of limited languages have directed our mind
> toward the 'you have to subclass' dictat. I wonder if SmallTalk GUIs
> have something like this.
Smalltalk supports inline anonymous code blocks, looking something like:

    mylist sort: [ :a :b | b-a ]

invokes the sort message on mylist, using a code block with two arguments, a
and b, using b-a as the comparison (implements a descending order sort).

-- Paul





More information about the Python-list mailing list