any trick to allow anonymous code blocks in python?

gabriele renzi surrender_it at remove.yahoo.it
Sat Jun 26 14:27:18 CEST 2004


il Sat, 26 Jun 2004 10:54:27 GMT, "Paul McGuire"
<ptmcg at austin.stopthespam_rr.com> ha scritto::

>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).
>

thank you, I knew this, but I was thinking about something else:

It seem to me that SmallTalk has singleton instance methods just like
ruby and python. Given that GUIs are tightly integrated with the ST
environment (while python uses toolkits that are mainly developed in
other languages like C ), It would be reasonable to see something on
the lines of what the OP was asking, like:

def b.onclick:
 foo



Or do you mean that everything in ST gui code is done via 

button when: #clicked do: [blockClosure] 

?



More information about the Python-list mailing list