Skip to main content

ListMixin

A base class which provides complete list interface.

Attributes

AttributeTypeDescription
_allowedtype or tupleA type or tuple of allowed item types [Optional]

Constructor

Signature

def ListMixin(
*args: any,
**kwargs: any
) - > null

Parameters

NameTypeDescription
*argsanyVariable length argument list passed to the superclass constructor.
**kwargsanyArbitrary keyword arguments passed to the superclass constructor.

Methods


count()

@classmethod
def count(
val: object
) - > int

Standard list count method

Parameters

NameTypeDescription
valobjectThe value to search for and count within the collection

Returns

TypeDescription
intThe total number of occurrences of the specified value in the collection

index()

@classmethod
def index(
val: object
) - > int

Standard list index method

Parameters

NameTypeDescription
valobjectThe value to locate within the collection

Returns

TypeDescription
intThe zero-based index of the first occurrence of the specified value

append()

@classmethod
def append(
val: object
)

Standard list append method

Parameters

NameTypeDescription
valobjectThe item to be added to the end of the collection

extend()

@classmethod
def extend(
vals: iterable
)

Standard list extend method

Parameters

NameTypeDescription
valsiterableAn 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

NameTypeDescription
indexintThe integer index before which the value should be inserted
valobjectThe item to insert into the collection

pop()

@classmethod
def pop(
index: int = -1
) - > object

Standard list pop method

Parameters

NameTypeDescription
indexint = -1The position of the item to remove and return; defaults to the last item

Returns

TypeDescription
objectThe item removed from the specified index

remove()

@classmethod
def remove(
val: object
)

Standard list remove method

Parameters

NameTypeDescription
valobjectThe 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

NameTypeDescription
keycallable = nullA function that serves as a key for the sort comparison
reversebool = falseIf set to True, the list elements are sorted as if each comparison were reversed