From: Guido van Rossum Date: Sat, 11 Jan 1997 19:21:33 +0000 (+0000) Subject: Add __len__ method X-Git-Tag: v1.5a1~545 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=88b85d4f6331001951000ba4125af52573421b4a;p=python Add __len__ method --- diff --git a/Lib/cgi.py b/Lib/cgi.py index 7fab38d875..34a6c6d702 100755 --- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -890,6 +890,10 @@ class FieldStorage: 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)