ListMixin
A base class which provides complete list interface.
Attributes
| Attribute | Type | Description |
|---|---|---|
| _allowed | type or tuple | A type or tuple of allowed item types [Optional] |
Constructor
Signature
def ListMixin(
*args: any,
**kwargs: any
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| *args | any | Variable length argument list passed to the superclass constructor. |
| **kwargs | any | Arbitrary keyword arguments passed to the superclass constructor. |
Methods
count()
@classmethod
def count(
val: object
) - > int
Standard list count method
Parameters
| Name | Type | Description |
|---|---|---|
| val | object | The value to search for and count within the collection |
Returns
| Type | Description |
|---|---|
int | The total number of occurrences of the specified value in the collection |
index()
@classmethod
def index(
val: object
) - > int
Standard list index method
Parameters
| Name | Type | Description |
|---|---|---|
| val | object | The value to locate within the collection |
Returns
| Type | Description |
|---|---|
int | The zero-based index of the first occurrence of the specified value |
append()
@classmethod
def append(
val: object
)
Standard list append method
Parameters
| Name | Type | Description |
|---|---|---|
| val | object | The item to be added to the end of the collection |
extend()
@classmethod
def extend(
vals: iterable
)
Standard list extend method
Parameters
| Name | Type | Description |
|---|---|---|
| vals | iterable | An iterable of items to be appended to the end of the collection |
insert()
@classmethod
def insert(
index: int,
val: object
)
Standard list insert method
Parameters
| Name | Type | Description |
|---|---|---|
| index | int | The integer index before which the value should be inserted |
| val | object | The item to insert into the collection |
pop()
@classmethod
def pop(
index: int = -1
) - > object
Standard list pop method
Parameters
| Name | Type | Description |
|---|---|---|
| index | int = -1 | The position of the item to remove and return; defaults to the last item |
Returns
| Type | Description |
|---|---|
object | The item removed from the specified index |
remove()
@classmethod
def remove(
val: object
)
Standard list remove method
Parameters
| Name | Type | Description |
|---|---|---|
| val | object | The first occurrence of this value will be removed from the collection |
reverse()
@classmethod
def reverse()
Standard list reverse method
sort()
@classmethod
def sort(
key: callable = null,
reverse: bool = false
)
Standard list sort method
Parameters
| Name | Type | Description |
|---|---|---|
| key | callable = null | A function that serves as a key for the sort comparison |
| reverse | bool = false | If set to True, the list elements are sorted as if each comparison were reversed |