From: Neil Cerutti on
On 2010-04-10, Patrick Maupin <pmaupin(a)gmail.com> wrote:
> Trust me, I already knew that. But what you just wrote is a
> much more useful thing to tell the OP than "Every time someone
> tries to parse nested structures using regular expressions,
> Jamie Zawinski kills a puppy" which is what I was responding
> to. And right after regurgitating that inside joke, Chris
> Rebert then went on to say "Try using an *actual* parser, such
> as Pyparsing". Which is all well and good, except then the OP
> will download pyparsing, take a look, realize that it uses
> regexps under the hood, and possibly be very confused.

I don't agree with that. If a person is trying to ski using
pieces of wood that they carved themselves, I don't expect them
to be surprised that the skis they buy are made out of similar
materials.

--
Neil Cerutti
From: Patrick Maupin on
On Apr 10, 11:35 am, Neil Cerutti <ne...(a)norwich.edu> wrote:
> On 2010-04-10, Patrick Maupin <pmau...(a)gmail.com> wrote:
> > as Pyparsing".  Which is all well and good, except then the OP
> > will download pyparsing, take a look, realize that it uses
> > regexps under the hood, and possibly be very confused.
>
> I don't agree with that. If a person is trying to ski using
> pieces of wood that they carved themselves, I don't expect them
> to be surprised that the skis they buy are made out of similar
> materials.

But, in this case, the guy ASKED how to make the skis in his
woodworking shop, and was told not to be silly -- you don't use wood
to make skis -- and then directed to go buy some skis that are, in
fact, made out of wood.

I think it would have been perfectly appropriate to point out that it
might take some additional woodworking equipment and a bit of
experience and/or study and/or extra work to make decent skis out of
wood (and, oh, by the way, here is where you can buy some ready-made
skis cheap), but the original response didn't explain it like this.

Regards,
Pat
From: Stefan Behnel on
Patrick Maupin, 10.04.2010 19:11:
> On Apr 10, 11:35 am, Neil Cerutti<ne...(a)norwich.edu> wrote:
>> On 2010-04-10, Patrick Maupin<pmau...(a)gmail.com> wrote:
>>> as Pyparsing". Which is all well and good, except then the OP
>>> will download pyparsing, take a look, realize that it uses
>>> regexps under the hood, and possibly be very confused.
>>
>> I don't agree with that. If a person is trying to ski using
>> pieces of wood that they carved themselves, I don't expect them
>> to be surprised that the skis they buy are made out of similar
>> materials.
>
> But, in this case, the guy ASKED how to make the skis in his
> woodworking shop, and was told not to be silly -- you don't use wood
> to make skis -- and then directed to go buy some skis that are, in
> fact, made out of wood.

Running a Python program in CPython eventually boils down to a sequence of
commands being executed by the CPU. That doesn't mean you should write
those commands manually, even if you can. It's perfectly ok to write the
program in Python instead.

Stefan

From: Ethan Furman on
Stefan Behnel wrote:
> Patrick Maupin, 10.04.2010 19:11:
>
>> On Apr 10, 11:35 am, Neil Cerutti<ne...(a)norwich.edu> wrote:
>>
>>> On 2010-04-10, Patrick Maupin<pmau...(a)gmail.com> wrote:
>>>
>>>> as Pyparsing". Which is all well and good, except then the OP
>>>> will download pyparsing, take a look, realize that it uses
>>>> regexps under the hood, and possibly be very confused.
>>>
>>>
>>> I don't agree with that. If a person is trying to ski using
>>> pieces of wood that they carved themselves, I don't expect them
>>> to be surprised that the skis they buy are made out of similar
>>> materials.
>>
>>
>> But, in this case, the guy ASKED how to make the skis in his
>> woodworking shop, and was told not to be silly -- you don't use wood
>> to make skis -- and then directed to go buy some skis that are, in
>> fact, made out of wood.
>
>
> Running a Python program in CPython eventually boils down to a sequence
> of commands being executed by the CPU. That doesn't mean you should
> write those commands manually, even if you can. It's perfectly ok to
> write the program in Python instead.
>
> Stefan

And it's even more perfectly okay to use Python when it's the best tool
for the job, and re when *it's* the best tool for the job.

~Ethan~
From: Steven D'Aprano on
On Sat, 10 Apr 2010 10:11:07 -0700, Patrick Maupin wrote:

> On Apr 10, 11:35 am, Neil Cerutti <ne...(a)norwich.edu> wrote:
>> On 2010-04-10, Patrick Maupin <pmau...(a)gmail.com> wrote:
>> > as Pyparsing".  Which is all well and good, except then the OP will
>> > download pyparsing, take a look, realize that it uses regexps under
>> > the hood, and possibly be very confused.
>>
>> I don't agree with that. If a person is trying to ski using pieces of
>> wood that they carved themselves, I don't expect them to be surprised
>> that the skis they buy are made out of similar materials.
>
> But, in this case, the guy ASKED how to make the skis in his woodworking
> shop, and was told not to be silly -- you don't use wood to make skis --
> and then directed to go buy some skis that are, in fact, made out of
> wood.

As entertaining as this is, the analogy is rubbish. Skis are far too
simple to use as an analogy for a parser (he says, having never seen skis
up close in his life *wink*). Have you looked at PyParsing's source code?
Regexes are only a small part of the parser, and not analogous to the
wood of skis.

Perhaps a better analogy would be a tennis racket, with regexes being the
strings. You have a whole lot of strings, not just one, and they are held
together with a strong framework. Without the framework the strings are
useless, and without the strings the racket doesn't do anything useful.

Using this analogy, I would say the OP was wanting to play tennis with a
single piece of string, and asking for advise on beefing it up to make it
work better. Perhaps a knot tied in one end will help?



--
Steven