mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Add __getitem__ to AddressList object, to make it a sequence.
This commit is contained in:
parent
872948350f
commit
81d10b479e
1 changed files with 4 additions and 0 deletions
|
|
@ -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]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue