Re: [Pyparsing] Grouping when using asList()
Brought to you by:
ptmcg
From: Ralph C. <ra...@in...> - 2008-03-08 13:14:10
|
Hi Paul, > Oooh, I'm *tempted*, so tempted. > > What do you think of Joshua's proposal of passing through the **kw dict? > It's a little more explicit without requiring the full ".setResultsName" > syntax. Side-by-side, the options are: > > A) date = twoDigitInt("month*") + '/' + twoDigitInt("day") > B) date = twoDigitInt("month", listAllMatches=True) + '/' + > twoDigitInt("day") I think that 'listAllMatches = True' is just noisy and interrupts the flow. > Mostly I'm concerned about accidental listAllMatches behavior when a > results name is set from within the parsing of a Dict, which is a bit > out of the developer's control - the results names are taken from the > input text stream, and could reasonably contain any of these options. OK. What about a second optional argument that's not a long keyword? Or guarantee that listAllMatches is it. Any truth value should do. dd('month', 1) + '/' + dd('day') Cheers, Ralph. |