diff Lib/socket.py @ 19372:36fa8e9bc2da legacy-trunk

Inspired by Greg Stein's proposed simplification of the _closesocket class, I came up with an even simpler solution: raise the error in __getattr__().
author Guido van Rossum <guido@python.org>
date Sat, 18 Aug 2001 21:00:39 +0000
parents b738428238f1
children edd9d0b3c47e
line wrap: on
line diff
--- a/Lib/socket.py	Sat Aug 18 20:18:49 2001 +0000
+++ b/Lib/socket.py	Sat Aug 18 21:00:39 2001 +0000
@@ -155,13 +155,9 @@
 
 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: