[Baypiggies] Eric Raymond likes Python

Andrew Dalke dalke at dalkescientific.com
Wed Sep 9 10:38:28 CEST 2009

On Sep 8, 2009, at 8:35 PM, Stephen McInerney wrote:
> Ok, so matching on the type of the object

That is not correct. Here's an example of OCaml matching on a value  
(not a type), to compute factorial.

  let rec fact = function
    | 0 -> 1
    | n -> n * fact(n-1);;

> ; either way, it's trivial to implement that in an
> OOP way by having a boolean predicate taking one optional arg  
> (lightColor),
> and suitably overriding it.

I think you are misunderstanding what they can do.  Pattern matching  
is more like multiple dispatch/multimethods.


The pattern match applies across all parameters, not just a single  

> Makes me wonder again how ancient the version he's criticizing is.
> If he avoided using classes, then of course he wouldn't be able to  
> do proper OOP.

There is more to the world than OOP.

> Does anyone think any of his criticisms are legitimate, on Python  
> 2.6/3.0?

The others weren't that legitimate (excepting xrange) even in 2.0.  
But I'm a Python developer in a Python user group mailing list, so  
should be considered biased. :)

				dalke at dalkescientific.com

More information about the Baypiggies mailing list