cf.CfList

class cf.CfList(sequence=())

Bases: _abcoll.MutableSequence

A list-like object with attributes.

Initialization

Parameters :
sequence : iterable, optional

Define a new list with these elements.

copy()

Return a deep copy.

Equivalent to copy.deepcopy(s).

Returns :
out :

The deep copy.

Examples

>>> s.copy()
count(value)

Return the number of occurrences of a given value.

Parameters :
value :

The value to count.

Returns :
out : int

The number of occurrences of value.

Examples

>>> s
[1, 2, 3, 2, 4, 2]
>>> s.count(1)
1
>>> s.count(2)
3
equals(other, rtol=None, atol=None, traceback=False)

True if two instances are logically equal, False otherwise.

Parameters :
other :

The object to compare for equality.

atol : float, optional

The absolute tolerance for all numerical comparisons, By default the value returned by the ATOL function is used.

rtol : float, optional

The relative tolerance for all numerical comparisons, By default the value returned by the RTOL function is used.

traceback : bool, optional

If True then print a traceback highlighting where the two instances differ.

Returns :
out : bool

Whether or not the two instances are equal.

index(value, start=0, stop=None)

Return the first index of a given value.

Parameters :

value :

start : int, optional

stop : int, optional

Returns :

out : int

Raises :
ValueError :

If the given value is not in the list.

Examples

>>> s
[1, 2, 3, 2, 4, 2]
>>> s.index(1)
1
>>> s.index(2, start=2)
3
>>> s.index(2, start=2, stop=4)
3
insert(index, object)

Insert an object before the given index in place.

Parameters :

index : int

object :

Returns :

None

Examples

>>> s
[1, 2, 3]
>>> s.insert(1, 'A')
>>> s
[1, 'A', 2, 3]

Previous topic

cf.CfDict

Next topic

cf.Variable

This Page