twisted.protocols.amp.ListOf(Argument) class documentationtwisted.protocols.amp
(View In Hierarchy)
Encode and decode lists of instances of a single other argument type.
For example, if you want to pass:
[3, 7, 9, 15]
You can create an argument like this:
ListOf(Integer())
The serialized form of the entire list is subject to the limit imposed 
by MAX_VALUE_LENGTH.
List elements are represented as 16-bit length prefixed strings.  The 
argument type passed to the ListOf 
initializer is responsible for producing the serialized form of each 
element.
| Parameters | optional | a boolean indicating whether this argument can be omitted in the protocol. | 
| Present Since | 10.0 | |
| Instance Variable | elementType | The Argumentinstance used to encode and decode list elements (note, not an arbitraryIArgumentTypeimplementation: arguments must be implemented using only thefromStringandtoStringmethods, not thefromBoxandtoBoxmethods). | 
| Method | __init__ | Create an Argument. | 
| Method | fromString | Convert the serialized form of a list of instances of some type back into that list. | 
| Method | toString | Serialize the given list of objects to a single string. | 
Inherited from Argument:
| Method | retrieve | Retrieve the given key from the given dictionary, removing it if found. | 
| Method | fromBox | Populate an 'out' dictionary with mapping names to Python values decoded from an 'in' AmpBox mapping strings to string values. | 
| Method | toBox | Populate an 'out' AmpBox with strings encoded from an 'in' dictionary mapping names to Python values. | 
| Method | fromStringProto | Convert a string to a Python value. | 
| Method | toStringProto | Convert a Python object to a string. | 
Argument
instance used to encode and decode list elements (note, not an arbitrary IArgumentType
implementation: arguments must be implemented using only the 
fromString and toString methods, not the 
fromBox and toBox methods).
  Create an Argument.
| Parameters | optional | a boolean indicating whether this argument can be omitted in the protocol. | 
Convert the serialized form of a list of instances of some type back into that list.
Serialize the given list of objects to a single string.