cf.FieldList.count

FieldList.count(value)[source]

Return number of occurrences of value

Each field in the field list is compared with the field’s equals method, as opposed to the == operator.

Note that fl.count(value) is equivalent to sum(f.equals(value) for f in fl).

See also

cf.Field.equals, list.count

Examples:
>>> f = cf.FieldList([a, b, c, a])
>>> f.count(a)
2
>>> f.count(b)
1
>>> f.count(a+1)
0