From 81d10b479e99581c26ca4c99d938bbb7c2b16f2e Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 16 Jun 1998 22:29:03 +0000 Subject: Add __getitem__ to AddressList object, to make it a sequence. --- Lib/rfc822.py | 4 ++++ 1 file changed, 4 insertions(+) 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]: -- cgit v0.12