[Baypiggies] Eric Raymond likes Python

Brian Palmer bpalmer at gmail.com
Tue Sep 8 20:13:26 CEST 2009

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20090908/b053ace4/attachment.htm>

More information about the Baypiggies mailing list