From 5a4ef267449e89ab7061475a3d7de342405219b2 Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Sat, 26 Sep 2009 00:16:14 -0400 Subject: [PATCH] remove confusing quote marks around 'key' and 'nonexistent_key' --- special-method-names.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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: