iu2 <[EMAIL PROTECTED]> wrote: > Is it possible to grant Python another syntactic mark, similar to > triple quotes, that will actually make the enclosed code a compiled > code, or an anonymous function? >
Yes, the syntactic mark you are looking for is 'def'. Your example becomes: >>> def dotimes(n, callable): for i in range(n): callable(i) >>> def block(i): for j in range(i): print j, print >>> dotimes(5, block) 0 0 1 0 1 2 0 1 2 3 The only thing you asked for that this doesn't do is make 'block' anonymous, but actually that is a good thing. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list