diff options
author | Guido van Rossum <guido@python.org> | 2001-08-18 21:00:39 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-08-18 21:00:39 (GMT) |
commit | 112ea6bfa61e67516f8ab7c0b5b46911d5f7e060 (patch) | |
tree | 62d7bd67b47d3361ee562781d5dc789a854b606c | |
parent | aa32070f4d7b7151974e70b407b0f0dc2a836313 (diff) | |
download | cpython-112ea6bfa61e67516f8ab7c0b5b46911d5f7e060.zip cpython-112ea6bfa61e67516f8ab7c0b5b46911d5f7e060.tar.gz cpython-112ea6bfa61e67516f8ab7c0b5b46911d5f7e060.tar.bz2 |
Inspired by Greg Stein's proposed simplification of the _closesocket
class, I came up with an even simpler solution: raise the error in
__getattr__().
-rw-r--r-- | Lib/socket.py | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/Lib/socket.py b/Lib/socket.py index ce72b65..ec8d610 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -155,13 +155,9 @@ class _socketobject: class _closedsocket: - def _bummer(self): + def __getattr__(self, name): raise error(9, 'Bad file descriptor') - _s = "def %s(self, *args): self._bummer()\n\n" - for _m in _socketmethods: - exec _s % _m - class _fileobject: |