Confessions of a Python fanboy

Masklinn masklinn at
Fri Jul 31 14:18:56 CEST 2009

On 31 Jul 2009, at 13:38 , Bruno Desthuilliers wrote:
> Steven D'Aprano a écrit :
>> On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote:
>>> That and the fact that I couldn't stop laughing for long enough to  
>>> learn
>>> any more when I read in the Pragmatic Programmer's Guide that "Ruby,
>>> unlike less flexible languages, lets you alter the value of a  
>>> constant."
>>> Yep, as they say "Bug" = "Undocumented feature"!
>> That's no different from Python's "constant by convention".
> Ruby's code blocks come from Smalltalk, where they are an absolute  
> necessity since message passing (which code blocks are part of) is  
> the *only* builtin control flow in Smalltalk - so you just *need*  
> this construction to provide branching and iterations.
I'm not so sure about the way you say it. I'm pretty sure  
"traditional" flow control structures preceded Smalltalk by a pair of  
decades so it's not that Smalltalk's designers found it necessary to  
use blocks & messages, but that they understood blocks & messages  
could trivially replace most control structures (making *those*  
unnecessary), making the core language simpler and more flexible.

In other words, I see it the other way around.

> Wether it makes sense to have code blocks in Ruby is another  
> question since Ruby does provide traditional control flow features
Well it does at least allow for the creation of new flow control  
structures in library land when the existing ones aren't enough (e.g.  
allows Ruby not to require the introduction of a `with` statement).  
Though Ruby's blocks are nowhere near as flexible as Smalltalk's.

More information about the Python-list mailing list