re beginner

John Machin sjmachin at lexicon.net
Sun Jun 4 22:40:47 EDT 2006


On 5/06/2006 10:07 AM, Paul McGuire wrote:
> "John Machin" <sjmachin at lexicon.net> wrote in message
> news:4483665A.206 at lexicon.net...
>> Fantastic -- at least for the OP's carefully copied-and-pasted input.
>> Meanwhile back in the real world, there might be problems with multiple
>> tabs used for 'prettiness' instead of 1 tab, non-integer values, etc etc.
>> In that case a loop approach that validated as it went and was able to
>> report the position and contents of any invalid input might be better.
> 
> Yeah, for that you'd need more like a real parser... hey, wait a minute!
> What about pyparsing?!
> 
> Here's a pyparsing version.  The definition of the parsing patterns takes
> little more than the re definition does - the bulk of the rest of the code
> is parsing/scanning the input and reporting the results.
> 

[big snip]

I didn't see any evidence of error handling in there anywhere.





More information about the Python-list mailing list