cf.Field.__getitem__¶
-
Field.
__getitem__
(index)[source]¶ Called to implement evaluation of f[index].
f.__getitem__(index) <==> f[index]
The field is treated as if it were a single element field list containing itself, i.e.
f[index]
is equivalent tocf.FieldList(f)[index]
.Examples 1: >>> g = f[0] >>> g = f[:1] >>> g = f[1:]
Returns: - out:
cf.Field
orcf.FieldList
If index is the integer 0 or -1 then the field itself is returned. If index is a slice then a field list is returned which is either empty or else contains a single element of the field itself.
See also
Examples 2: >>> f[0] is f[-1] is f True >>> f[0:1].equals(cf.FieldList(f)) True >>> f[0:1][0] is f True >>> f[1:].equals(cf.FieldList()) True >>> f[1:] [] >>> f[-1::3][0] is f True
- out: