Bases: list
A list variant which accepts only one type of element.
A ValidatedList is a regular Python list with overriden methods which helps validating the elements in regular list actions. Uses the type of the first assigned element if no type_ is defined.
Reduces the given list_ to elements with the same type of the first element if the type_ argument is None or uses the type_ argument if given.
Parameters: |
|
---|
Methods
__init__([list_, type_]) | |
append(object) | L.append(object) – append object to end |
extend(iterable) | L.extend(iterable) – extend list by appending elements from the iterable |
insert(index, object) | L.insert(index, object) – insert object before index |
Attributes
count | L.count(value) -> integer – return number of occurrences of value |
index | L.index(value, [start, [stop]]) -> integer – return first index of value. |
pop | L.pop([index]) -> item – remove and return item at index (default last). |
remove | L.remove(value) – remove first occurrence of value. |
reverse | L.reverse() – reverse IN PLACE |
sort | L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE; |
L.append(object) – append object to end
This is the overriden version of the original method.
L.extend(iterable) – extend list by appending elements from the iterable
This is the overriden version of the original method.
L.insert(index, object) – insert object before index
This is the overriden version of the original method.
L.count(value) -> integer – return number of occurrences of value
L.index(value, [start, [stop]]) -> integer – return first index of value. Raises ValueError if the value is not present.
L.pop([index]) -> item – remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
L.remove(value) – remove first occurrence of value. Raises ValueError if the value is not present.
L.reverse() – reverse IN PLACE
L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE; cmp(x, y) -> -1, 0, 1