diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2003-03-10 15:12:00 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2003-03-10 15:12:00 (GMT) |
commit | faef74a2b06e92645f632182f1569e455793b179 (patch) | |
tree | 7b83f22b7b481a7bd2a20eaf78f2f4402b723758 /Lib | |
parent | 796376338fce096cf57ef6b92812f34cd47ffe20 (diff) | |
download | cpython-faef74a2b06e92645f632182f1569e455793b179.zip cpython-faef74a2b06e92645f632182f1569e455793b179.tar.gz cpython-faef74a2b06e92645f632182f1569e455793b179.tar.bz2 |
Use isinstance() instead of type comparison
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/asynchat.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/asynchat.py b/Lib/asynchat.py index 1ba6b15..081031a 100644 --- a/Lib/asynchat.py +++ b/Lib/asynchat.py @@ -104,7 +104,7 @@ class async_chat (asyncore.dispatcher): # no terminator, collect it all self.collect_incoming_data (self.ac_in_buffer) self.ac_in_buffer = '' - elif type(terminator) == type(0): + elif isinstance(terminator, int): # numeric terminator n = terminator if lb < n: @@ -183,7 +183,6 @@ class async_chat (asyncore.dispatcher): # refill the outgoing buffer by calling the more() method # of the first producer in the queue def refill_buffer (self): - _string_type = type('') while 1: if len(self.producer_fifo): p = self.producer_fifo.first() @@ -194,7 +193,7 @@ class async_chat (asyncore.dispatcher): self.producer_fifo.pop() self.close() return - elif type(p) is _string_type: + elif isinstance(p, str): self.producer_fifo.pop() self.ac_out_buffer = self.ac_out_buffer + p return |