Re: [Pyparsing] Check for tabs
Brought to you by:
ptmcg
From: d* <d*@y23.org> - 2013-10-29 15:07:58
|
Hi, I see nothing wrong with using pyparsing. There are actually many ways to solve the problem here. If you expect to be using pyparsing more in the future and expect to have multiple users maintaining the code I'd keep it simple and just stick to one paradigm and stay in the pyparsing realm. I'm no expert at pyparsing yet, and find myself still continuing to learn it as I go. I've become a fan of pair programming as well where two of us are learning pyparsing at the same time. There is nothing wrong with regex. I use it where its needed, but in general, I have found I don't mix it with the pyparsing code modules. And by doing so I've managed to get several different 'grammars' now robustly working. I don't see the overkill argument. When one walks into a factory and looks at the machinery for example. Is overkill that a machine the size of a truck cuts the same pattern 2000 times a day to an endless supply of steel? I doubt it. The work probably was done in the past by less refined machines and more than likely you are looking at the latest and newest production model for that type of work. I see it as, "Why do extra work, when you can have code that has been tested and end up doing less work?" Good luck on which ever method(s) you choose to implement. And don't forget to have some fun while you are doing it :) David > -------Original Message------- > From: Diez B. Roggisch <de...@we...> > To: Hanchel Cheng <han...@br...> > Cc: pyp...@li... <pyp...@li...> > Subject: Re: [Pyparsing] Check for tabs > Sent: Oct 29 '13 03:09 > > > On Oct 29, 2013, at 12:41 AM, Hanchel Cheng <han...@br...> wrote: > > > Regardless of "all [I] have," I'd like to know if pyparser can check for a specific number of tabs between alphanumeric strings. If there are not two tabs between the 2nd and 3rd word, I'd like to error out. Is pyparsing truly overkill for this task? > > I think by now you have your answer: yes, you can do it with pyparsing, but IMHO it's overkill, if that's all you ask it to do. Probably even using a regex would be more opaque then necessary. > > I've use pyparsing happily quite a few times to e.g. parse CSS or small DSLs. But for this kind of thing, I'd use string-methods. > > Diez > ------------------------------------------------------------------------------ > Android is increasing in popularity, but the open development platform that > developers love is also attractive to malware creators. Download this white > paper to learn more about secure code signing practices that can help keep > Android apps secure. > http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk > _______________________________________________ > Pyparsing-users mailing list > Pyp...@li... > https://lists.sourceforge.net/lists/listinfo/pyparsing-users > |