diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-11 19:13:28 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-11 19:13:28 (GMT) |
commit | ab14088141ab749763e35b7a49e79c368940e12d (patch) | |
tree | 0369f9a136bfea659c24b0cf9fedf2ee98272308 /Lib/sre_parse.py | |
parent | 9a64ccb997a99f85c2538047823c7478bfcff6ed (diff) | |
download | cpython-ab14088141ab749763e35b7a49e79c368940e12d.zip cpython-ab14088141ab749763e35b7a49e79c368940e12d.tar.gz cpython-ab14088141ab749763e35b7a49e79c368940e12d.tar.bz2 |
Minor code clean up and improvements in the re module.
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r-- | Lib/sre_parse.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index aa2d64b..45411f8 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -103,18 +103,18 @@ class SubPattern: seqtypes = (tuple, list) for op, av in self.data: print(level*" " + str(op), end='') - if op == IN: + if op is IN: # member sublanguage print() for op, a in av: print((level+1)*" " + str(op), a) - elif op == BRANCH: + elif op is BRANCH: print() for i, a in enumerate(av[1]): if i: print(level*" " + "OR") a.dump(level+1) - elif op == GROUPREF_EXISTS: + elif op is GROUPREF_EXISTS: condgroup, item_yes, item_no = av print('', condgroup) item_yes.dump(level+1) @@ -607,7 +607,7 @@ def _parse(source, state): item = subpattern[-1:] else: item = None - if not item or (_len(item) == 1 and item[0][0] == AT): + if not item or (_len(item) == 1 and item[0][0] is AT): raise source.error("nothing to repeat", source.tell() - here + len(this)) if item[0][0] in _REPEATCODES: |