Theerasak Photha skrev: > On 14 Oct 2006 09:25:00 -0700, Paul Boddie <[EMAIL PROTECTED]> wrote: > > > Unlike Java, Python's first class functions and > > methods are already highly useful for callback-based systems > > Curious: how well does the use of returning inner functions work as a > strategy for providing effectively 'anonymous' callbacks? e.g. > > def outer(x): > def inner(y): > ... > return inner
Well enough, I'd imagine. There may be people who resent having to use a statement to create a block of code, especially one which defines a local name (the horror!), but as the lambda replacement discussions showed, a sub-statement code block doesn't necessarily have an acceptable formulation in non-Lisp-like languages. Or, at least, people struggled to find such a formulation in Python which didn't severely affect readability, and there are people who regard even uncontroversial but related things as list comprehensions as being much less readable than most other constructs in the language. Paul -- http://mail.python.org/mailman/listinfo/python-list