[Baypiggies] Eric Raymond likes Python
Rami Chowdhury
rami.chowdhury at gmail.com
Tue Sep 8 20:46:10 CEST 2009
> Does anyone think any of his criticisms are legitimate, on Python
> 2.6/3.0?
Well...
> And even no switches
> — actually even PHP has it.
If he's referring to the switch statement there, then he does have a
point, Python doesn't have a switch statement ;-). (Not that I think it's
particularly necessary, personally, as there's lots of other ways to do it
(and, arguably, better ones)).
On Tue, 08 Sep 2009 11:35:08 -0700, Stephen McInerney
<spmcinerney at hotmail.com> wrote:
>
> 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
--
Rami Chowdhury
"Never attribute to malice that which can be attributed to stupidity" --
Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
More information about the Baypiggies
mailing list