Use isinstance instead of type == type
authorChristian Ebert <blacktrash@gmx.net>
Fri, 06 Jul 2007 12:02:43 +0200
changeset 4874 d9e385a7a806
parent 4873 28b23b9073a8
child 4875 97dbf330069a
Use isinstance instead of type == type
mercurial/hgweb/hgweb_mod.py
tests/coverage.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -64,7 +64,7 @@ def revnavgen(pos, pagelen, limit, nodef
 
 class hgweb(object):
     def __init__(self, repo, name=None):
-        if type(repo) == type(""):
+        if isinstance(repo, str):
             self.repo = hg.repository(ui.ui(report_untrusted=False), repo)
         else:
             self.repo = repo
--- a/tests/coverage.py
+++ b/tests/coverage.py
@@ -504,7 +504,7 @@ class coverage:
     def get_suite_spots(self, tree, spots):
         import symbol, token
         for i in range(1, len(tree)):
-            if type(tree[i]) == type(()):
+            if isinstance(tree[i], tuple):
                 if tree[i][0] == symbol.suite:
                     # Found a suite, look back for the colon and keyword.
                     lineno_colon = lineno_word = None