[tor-commits] [pytorctl/master] Use isinstance rather than "is type()" for type checks.

mikeperry at torproject.org mikeperry at torproject.org
Sat Feb 26 02:37:14 UTC 2011


commit b334a18c8c5b4d8c8ffb5609c6dd1414813aeb30
Author: Mike Perry <mikeperry-git at fscked.org>
Date:   Fri Feb 25 18:36:20 2011 -0800

    Use isinstance rather than "is type()" for type checks.
---
 TorUtil.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/TorUtil.py b/TorUtil.py
index 27ffdc9..46a561d 100644
--- a/TorUtil.py
+++ b/TorUtil.py
@@ -339,7 +339,7 @@ def plog(level, msg, *args):
     if not logfile:
       logfile = sys.stdout
     # HACK: if logfile is a string, assume is it the desired filename.
-    if type(logfile) is str or type(logfile) is unicode:
+    if isinstance(logfile, str) or isinstance(logfile, unicode):
       f = logging.FileHandler(logfile)
       f.setFormatter(formatter)
       logger.addHandler(f)



More information about the tor-commits mailing list