[Python-3000] A plea for anonymous functions
Guido van Rossum
guido at python.org
Fri Nov 17 05:29:33 CET 2006
If you want anonymous blocks, by all means use Ruby. Python has
first-class callables, Ruby has anonymous blocks. Pick your favorite,
but don't whine that neither language has both. It ain't gonna happen.
On 11/16/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Talin wrote:
> > From my point of view, both 'with' and generator expressions are
> > limited, special-case solutions to a general problem - the desire to be
> > able to use and manipulate unnamed blocks of code as first-class
> > objects.
> I don't think it's as simple as that. Back when the with
> statement was first being discussed, I suggested that it
> should be implemented by passing the body as an anonymous
> function. That would have been a very simple way of doing
> it, but there were problems, such as what to do if the
> body contained break or continue statements. In the end,
> Guido rejected the anonymous-function approach, and we
> ended up with something that is rather more elaborate.
> So we have a situation where there was no syntactical
> barrier to treating a code block as an anonymous function,
> but we chose not to do so. That seems to cast doubt on
> the idea that first-class code blocks would solve all
> the problems you suggest they would solve.
> Python-3000 mailing list
> Python-3000 at python.org
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000