any trick to allow anonymous code blocks in python?

Tor Iver Wilhelmsen tor.iver.wilhelmsen at broadpark.no
Sat Jun 26 03:45:18 EDT 2004


Christian Tismer <tismer at stackless.com> writes:

> What exactly do you want to do?
> Why is defining a function too much for you?

One argument for "anonymous functions to be assigned to another
object" is that defining such functions "pollute" the namespace with
names that only serve one purpose, yet remain in some scope where they
are no longer needed unless you delete them.

def myAction():
    print "You clicked me"

b.OnClick = myAction

del(myAction)

etc.



More information about the Python-list mailing list