From: Kaliko Jack Date: Mon, 15 Apr 2013 19:21:14 +0000 (+0200) Subject: Use of hasattr instead of isinstance in disconnect X-Git-Tag: v0.3.1b~1 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=82935e106152ee3feebf64be854583ceee4d60e5;p=python-musicpd.git Use of hasattr instead of isinstance in disconnect --- diff --git a/mpd.py b/mpd.py index b504428..7c7f016 100644 --- a/mpd.py +++ b/mpd.py @@ -435,14 +435,11 @@ class MPDClient(object): raise def disconnect(self): - if isinstance(self._rfile, socket._fileobject): - print('closing r socket') + if hasattr(self._rfile, 'close'): self._rfile.close() - if isinstance(self._wfile, socket._fileobject): - print('closing w socket') + if hasattr(self._wfile, 'close'): self._wfile.close() if isinstance(self._sock, socket.socket): - print('closing socket') self._sock.close() self._reset()