From 88b85d4f6331001951000ba4125af52573421b4a Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sat, 11 Jan 1997 19:21:33 +0000 Subject: [PATCH] Add __len__ method --- Lib/cgi.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/cgi.py b/Lib/cgi.py index 7fab38d8753..34a6c6d7026 100755 --- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -890,6 +890,10 @@ def has_key(self, key): if item.name == key: return 1 return 0 + def __len__(self): + """Dictionary style len(x) support.""" + return len(self.keys()) + def read_urlencoded(self): """Internal: read data in query string format.""" qs = self.fp.read(self.length)