diff options
author | ptmcg <ptmcg@austin.rr.com> | 2022-06-23 12:53:38 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2022-06-23 12:53:38 -0500 |
commit | 18abf0727deb9b1a4f93f2747345d4e9ea0e8d69 (patch) | |
tree | 74ce4675e83fedf8c0b40b1b7d354beb6d462f74 /pyparsing/results.py | |
parent | 3e463215b7cf77fa121c9dce52ee19b59b0f69da (diff) | |
download | pyparsing-git-18abf0727deb9b1a4f93f2747345d4e9ea0e8d69.tar.gz |
Simplify code that incrementally builds a ParseResults
Diffstat (limited to 'pyparsing/results.py')
-rw-r--r-- | pyparsing/results.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pyparsing/results.py b/pyparsing/results.py index 892cbd9..a14e0f8 100644 --- a/pyparsing/results.py +++ b/pyparsing/results.py @@ -262,7 +262,7 @@ class ParseResults: """ Since ``keys()`` returns an iterator, this method is helpful in bypassing code that looks for the existence of any defined results names.""" - return bool(self._tokdict) + return not not self._tokdict def pop(self, *args, **kwargs): """ @@ -426,6 +426,9 @@ class ParseResults: return ret def __iadd__(self, other) -> "ParseResults": + if not other: + return self + if other._tokdict: offset = len(self._toklist) addoffset = lambda a: offset if a < 0 else a + offset |