Proposed API change for pyparsing CaselessLiteral - could break existing code

Dan Dang Griffith google0 at lazytwinacres.net
Wed Apr 28 16:44:06 EDT 2004


"Paul McGuire" <ptmcg at austin.rr._bogus_.com> wrote in message news:<geDic.22772$hR1.20302 at fe2.texas.rr.com>...
> So for those of you who are still reading, and who use pyparsing, and have
> CaselessLiterals in your code, and test on the returned text, what choice
> would you prefer:
> 
> 1. Keep the current behavior, and just change the docs.
> 2. Fix the current behavior to match the docs, and fix up any code that uses
> it.
> 
> My personal preference is #2.  We are still early in pyparsing's code life -
> it has only been generally available for about 4 months - and I think it
> really is the preferred way to go.

I'm +1 on #2, i.e., change the code to match the docs.
I have a use case where the parser is acting as a "cleanup"
to the input, making it conform to a coding standard,
and CaselessLiteral working as described in the docs
would be perfect.  I suppose I could make a setParseAction
that would convert it to the appropriate case, but that
would slow it down, plus I'd have to keep track of the 
literal in two places (well, I suppose I could define 
a name for the value and import it from my grammar and
from the code that has the parse actions, but still...).

Thanks for pyparsing.
    --dang



More information about the Python-list mailing list