12.6.2 AddressList Objects

An AddressList instance has the following methods:

__len__ (name)
Return the number of addresses in the address list.

__str__ (name)
Return a canonicalized string representation of the address list. Addresses are rendered in "name" <host@domain> form, comma-separated.

__add__ (name)
Return an AddressList instance that contains all addresses in both AddressList operands, with duplicates removed (set union).

__sub__ (name)
Return an AddressList instance that contains every address in the left-hand AddressList operand that is not present in the right-hand address operand (set difference).

Finally, AddressList instances have one public instance variable:

addresslist
A list of tuple string pairs, one per address. In each member, the first is the canonicalized name part of the address, the second is the route-address (@-separated host-domain pair).


Send comments on this document to python-docs@python.org.