[Python-ideas] Anonymous blocks (again):

Steven D'Aprano steve at pearwood.info
Mon May 13 06:47:15 CEST 2013


On 13/05/13 13:58, Juancarlo Añez wrote:

> I don't want new syntax (I think I don't).
>
> What I want is to be able to invoke a block of code repeatedly, within a
> context, and in a pythonic way.

Surely that would be:

with context():
     while condition: # or a for loop
         block of code goes here


If you want something different to this, then I think you do want new syntax. Otherwise, what do you gain beyond what can already be done now?

Or am I missing something?


-- 
Steven



More information about the Python-ideas mailing list