Brian Quinlan wrote:
if not self.__closed:
try:
- self.flush()
+ IOBase.flush(self)
except IOError:
pass # If flush() fails, just give up
self.__closed = True
That doesn't seem like a good idea to me at all. If
someone overrides flush() but not close(), their
flush method won't get called, which would be surprising.
To get the desired behaviour, you need something like
def close(self):
if not self.__closed:
self.flush()
self._close()
self.__closed = True
and then tell people to override _close() rather than
close().
--
Greg
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com