Bases: _abcoll.MutableSequence
A list-like object with attributes.
Initialization
Parameters : |
|
---|
CfList methods (undocumented methods behave exactly as their counterparts in a built-in list)
append | |
copy | Return a deep copy. |
count | Return the number of occurrences of a given value. |
equals | True if two instances are equal, False otherwise. |
extend | |
index | Return the first index of a given value. |
insert | Insert an object before the given index in place. |
pop | |
remove | |
reverse |
Return a deep copy.
Equivalent to copy.deepcopy(s).
Returns : |
|
---|
Examples
>>> s.copy()
Return the number of occurrences of a given value.
Uses numerically tolerant equality where appropriate.
Parameters : |
|
---|---|
Returns : |
|
Examples
>>> s
[1, 2, 3, 2, 4, 2]
>>> s.count(1)
1
>>> s.count(2)
3
True if two instances are equal, False otherwise.
Two instances are equal if their attributes are equal and their elements are equal pair-wise.
Parameters : |
|
---|---|
Returns : |
|
Return the first index of a given value.
Uses numerically tolerant equality where appropriate.
Parameters : |
|
---|---|
Returns : | out : int |
Raises : |
|
Examples
>>> s
[1, 2, 3, 2, 4, 2]
>>> s.index(1)
1
>>> s.index(2, 2)
3
>>> s.index(2, start=2, stop=5)
3
>>> s.index(6)
ValueError: CfList doesn't contain: 6
Insert an object before the given index in place.
Parameters : | index : int item : |
---|---|
Returns : | None |
Examples
>>> s
[1, 2, 3]
>>> s.insert(1, 'A')
>>> s
[1, 'A', 2, 3]
>>> s.insert(100, 'B')
[1, 'A', 2, 3, 'B']
>>> s.insert(100, 'B')
[1, 'A', 2, 3, 'B']
>>> s.insert(-2, 'C')
[1, 'A', 2, 'C', 3, 'B']
>>> s.insert(-100, 'D')
['D', 1, 'A', 2, 'C', 3, 'B']