Who's minister of propaganda this week?

Paul Prescod paulp at ActiveState.com
Wed Mar 14 15:11:16 EST 2001


Don Dwiggins wrote:
> 
>...
> I'm relatively new to Python, and this is something I'm trying to get my
> head around.  I know that closures (blocks) are extremely important in
> Smalltalk (e.g., conditionals and looping are implemented entirely in terms
> of blocks).  So, is this just an indication of Smalltalk's peculiarity, 

Well, you could argue that it's a form of elegance...but yes, it is
somewhat unique to Smalltalk. Even lisps don't, in general, treat
conditionals as a form of closure.

> or
> could Python benefit from the ability to exploit more robust closures in
> something like the manner of Smalltalk?  For example, how about implementing
> general iteration as something a container class does to a closure (as in
> select:, detect:, inject:into:, etc.)?

I don't know enough to comment in detail ... but I suspect there are
Pythonic ways to do the same sorts of things. Rather than turning blocks
into closures and closures into objects, Python would ask you to use
more traditional object oriented structures like classes and __getitem__
or __getiterator__ methods. (Note that the latter is semi-fanciful)

-- 
Python:
    Programming the way
    Guido
    indented it.
       - (originated with Skip Montanaro?)




More information about the Python-list mailing list