mirror of
https://github.com/python/cpython.git
synced 2026-01-06 23:42:34 +00:00
Use isinstance() instead of type comparison
This commit is contained in:
parent
796376338f
commit
faef74a2b0
1 changed files with 2 additions and 3 deletions
|
|
@ -104,7 +104,7 @@ def handle_read (self):
|
|||
# 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 @@ def close_when_done (self):
|
|||
# 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 @@ def refill_buffer (self):
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue