[Pyparsing] setResultsName() not working as expected
Brought to you by:
ptmcg
From: cathal c. <cof...@gm...> - 2011-07-02 20:18:14
|
Guys, I have the following but I don't like it because I am basically repeating code just to change the results name depending on the situation. field = '$' + Combine(Word(alphanums)).setResultsName('field_name') as_field = '$' + Combine(Word(alphanums)).setResultsName('new_field_name') I would much prefer to do something like this. field = '$'.suppress() + Combine(Word(alphanums)) as_field = field.copy() field.setResultsName('field_name') as_field.setResultsName('new_field_name') The second however doesn't parse as expected. Why aren't the two of these equivalent? Kind regards, Cathal |