[Python-Dev] Ruby-style Blocks in Python [Pseudo-PEP]

Duncan Booth duncan.booth at suttoncourtenay.org.uk
Sun Mar 8 16:51:35 CET 2009

tav <tav at espians.com> wrote:

> I explain in detail in this blog article:
>   http://tav.espians.com/ruby-style-blocks-in-python.html

"This is also possible in Python but at the needless cost of naming and 
defining a function first"

The cost of defining the function first is probably much less than the cost 
of your __do__ function. Your proposal seems to be much more limited than 
passing functions around e.g. Python allows you to pass in multiple 
functions where appropriate, or to store them for later calling. 

More information about the Python-Dev mailing list