]> granicus.if.org Git - python/commitdiff
Add __len__ method
authorGuido van Rossum <guido@python.org>
Sat, 11 Jan 1997 19:21:33 +0000 (19:21 +0000)
committerGuido van Rossum <guido@python.org>
Sat, 11 Jan 1997 19:21:33 +0000 (19:21 +0000)
Lib/cgi.py

index 7fab38d87535c2f8c8a3a13ac45730f5e765085d..34a6c6d70268cc257d7faec8c3a45837fad285dd 100755 (executable)
@@ -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)