[Python-ideas] As-do statements/anonymous blocks in python

Steven D'Aprano steve at pearwood.info
Fri Jul 27 02:35:42 EDT 2018

I *think* you are trying to find a syntax for "code blocks" like Ruby
has, but I'm not sure. Your examples are a little confusing to me 
(possibly because you have at least three separate suggestions here, 
"as" blocks, a mysterious "do" keyword I don't understand, and partial 
application using % as argument placeholder).

Many people have tried to find a syntax for code block expressions, none 
have succeeded. Please note that being an *expression* is critical. We 
already have syntax for code block statements, it is the "def" keyword.

You probably ought to spend a few days searching the mailing list 
archives for previous discussions before you get your hopes up.

Before I spend any more time on this proposal, I'll skip right to the
end of your post:

On Wed, Jul 25, 2018 at 01:07:50PM -0400, James Lu wrote:
> I’m not totally sure of practical uses,

If you don't have practical uses, this proposal has ZERO chance of being

Sometimes we can't get proposals accepted even with practical uses.

> but I’m imagining it would make
> passing a function to another function much more convenient.

I don't see how it can be more convenient than:



More information about the Python-ideas mailing list