summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-06-16 22:29:03 (GMT)
committerGuido van Rossum <guido@python.org>1998-06-16 22:29:03 (GMT)
commit81d10b479e99581c26ca4c99d938bbb7c2b16f2e (patch)
tree6392df6039772fccb543ad7a117d867a9f752600
parent872948350fbb3d96189671c5bbad55cda1c9e4ff (diff)
downloadcpython-81d10b479e99581c26ca4c99d938bbb7c2b16f2e.zip
cpython-81d10b479e99581c26ca4c99d938bbb7c2b16f2e.tar.gz
cpython-81d10b479e99581c26ca4c99d938bbb7c2b16f2e.tar.bz2
Add __getitem__ to AddressList object, to make it a sequence.
-rw-r--r--Lib/rfc822.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/rfc822.py b/Lib/rfc822.py
index ade3506..87d7d39 100644
--- a/Lib/rfc822.py
+++ b/Lib/rfc822.py
@@ -728,6 +728,10 @@ class AddressList(AddrlistClass):
newaddr.addresslist.append(x)
return newaddr
+ def __getitem__(self, index):
+ # Make indexing, slices, and 'in' work
+ return self.addrlist[index]
+
def dump_address_pair(pair):
"""Dump a (name, address) pair in a canonicalized form."""
if pair[0]: