[Python-Dev] anonymous blocks

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 21 05:11:38 CEST 2005

Josiah Carlson wrote:

> I once asked "Any other
> use cases for one of the most powerful features of Ruby, in Python?"  I
> have yet to hear any sort of reasonable response.
> Why am I getting no response to my question?  Either it is because I am
> being ignored, or no one has taken the time to translate one of these
> 'killer features' from Smalltalk or Ruby, or perhaps such translations
> show that there is a better way in Python already.

My feeling is that it's the latter. I don't know about Ruby, but
in Smalltalk, block-passing is used so heavily because it's the
main way of implementing control structures there. While-loops,
for-loops, even if-then-else, are not built into the language,
but are implemented by methods that take block parameters.

In Python, most of these are taken care of by built-in statements,
or various uses of iterators and generators. There isn't all that
much left that people want to do on a regular basis.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list