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.
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 @@
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 @@
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 @@
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