[Baypiggies] Eric Raymond likes Python

Stephen McInerney spmcinerney at hotmail.com
Tue Sep 8 20:35:08 CEST 2009


Ok, so matching on the type of the object; 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. 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.

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


Date: Tue, 8 Sep 2009 11:13:26 -0700
Subject: Re: [Baypiggies] Eric Raymond likes Python
From: bpalmer at gmail.com
To: spmcinerney at hotmail.com
CC: baypiggies at python.org

On Tue, Sep 8, 2009 at 10:51 AM, Stephen McInerney <spmcinerney at hotmail.com> wrote:







> From: wescpy at gmail.comNo pattern matching. And even no switches
— actually even PHP has it. Some people recommend to use “if – else if”
constructions instead…[??? re module was added way back in Python 1.5, and before that there was regex] 
He's talking about a different form of pattern matching. A haskell-like pattern matching examle:


  should_stop: Car -> Light -> Boolean
  should_stop Ambulance _  = False 
  should_stop _ Red = True
  should_stop _ _ = False  

should_stop would be a function that says whether a car should stop at a light. Ambulances never stop regardless of the light; all other cars stop at red; and otherwise, cars don't stop. 




_________________________________________________________________
With Windows Live, you can organize, edit, and share your photos.
http://www.windowslive.com/Desktop/PhotoGallery
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20090908/15565f55/attachment.htm>


More information about the Baypiggies mailing list