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

James Lu jamtlu at gmail.com
Fri Jul 27 23:51:55 EDT 2018


By passing a function to another function I meant passing a code block as an inline function to a function call.

The do statement is simply the arguments the function is called with

Brackets = optional
as expr [do comma-separated-expressions]:
    block

means evaluate expr, then call the result of the expression. If do is present, call it with the argument list after do. Otherwise, call it with no arguments. 

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

I have already shown a Flask use case and another poster has mentioned they would find it useful in their own code. (Though they had reservations on whether it should be included in Python.)

I simply said I wasn’t totally aware of all practical use cases, especially practical abuse cases. 


More information about the Python-ideas mailing list