From: Guido van Rossum Date: Tue, 16 Jun 1998 22:29:03 +0000 (+0000) Subject: Add __getitem__ to AddressList object, to make it a sequence. X-Git-Tag: v1.5.2a1~459 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=81d10b479e99581c26ca4c99d938bbb7c2b16f2e;p=python Add __getitem__ to AddressList object, to make it a sequence. --- diff --git a/Lib/rfc822.py b/Lib/rfc822.py index ade35061b4..87d7d394b9 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]: