diff --git a/special-method-names.html b/special-method-names.html index 14ff127..22a860b 100644 --- a/special-method-names.html +++ b/special-method-names.html @@ -306,19 +306,19 @@ class FieldStorage: to get a value by its key x[key] -x.__getitem__('key') +x.__getitem__(key) to set a value by its key x[key] = value -x.__setitem__('key', value) +x.__setitem__(key, value) to delete a key-value pair del x[key] -x.__delitem__('key') +x.__delitem__(key) to provide a default value for missing keys x[nonexistent_key] -x.__missing__('nonexistent_key') +x.__missing__(nonexistent_key)

The FieldStorage class from the cgi module also defines these special methods, which means you can do things like this: