summaryrefslogtreecommitdiffstats
path: root/Lib/regsub.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-12-12 23:20:45 (GMT)
committerFred Drake <fdrake@acm.org>2000-12-12 23:20:45 (GMT)
commit8152d32375c40bba9ccbe43b780ebe96d9617781 (patch)
treef10aba5ba6f1e3064b26d2edfd6fffb45378245d /Lib/regsub.py
parentc140131995c67b1cd001b5c27e0095c53b1204b4 (diff)
downloadcpython-8152d32375c40bba9ccbe43b780ebe96d9617781.zip
cpython-8152d32375c40bba9ccbe43b780ebe96d9617781.tar.gz
cpython-8152d32375c40bba9ccbe43b780ebe96d9617781.tar.bz2
Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent". Use "is" and "is not" when comparing with None or type objects.
Diffstat (limited to 'Lib/regsub.py')
-rw-r--r--Lib/regsub.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/regsub.py b/Lib/regsub.py
index 8e341bb..dc95028 100644
--- a/Lib/regsub.py
+++ b/Lib/regsub.py
@@ -124,7 +124,7 @@ def capwords(str, pat='[^a-zA-Z0-9_]+'):
cache = {}
def compile(pat):
- if type(pat) <> type(''):
+ if type(pat) != type(''):
return pat # Assume it is a compiled regex
key = (pat, regex.get_syntax())
if cache.has_key(key):
@@ -153,7 +153,7 @@ def expand(repl, regs, str):
ord0 = ord('0')
while i < len(repl):
c = repl[i]; i = i+1
- if c <> '\\' or i >= len(repl):
+ if c != '\\' or i >= len(repl):
new = new + c
else:
c = repl[i]; i = i+1
@@ -182,7 +182,7 @@ def test():
if not line: break
if line[-1] == '\n': line = line[:-1]
fields = split(line, delpat)
- if len(fields) <> 3:
+ if len(fields) != 3:
print 'Sorry, not three fields'
print 'split:', `fields`
continue