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. -- Greg _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com