nustack

sized

Sized capability.

Module nu.forms.collections.abc.sized.

Sized capability.

SizedForm: values that have a length.

Follows Python's collections.abc.Sized pattern.

NameCallMeaning
SizedFormSizedForm()Base for values that have a length, like collections.abc.Sized.

SizedForm

Base for values that have a length, like collections.abc.Sized.

SizedForm()

Path nu.forms.collections.abc.SizedForm.

Example

nu.run(nu.List([1, 2, 3]).len())[0]
3

Methods

.len()

Length of self.

Builds Int.

Yields

The element count as Int. EMPTY when self is EMPTY.

Example

nu.run(nu.List([1, 2, 3]).len())[0]
3

Inherited methods

From nu.lang.forms.Form:

CallBuildsMeaning
a == bBoolSelf equal to other by value: an Eq term, never a Python bool.
a != bBoolSelf not equal to other by value: a Ne term, never a Python bool.
.is_empty()BoolTrue if this Form yields the EMPTY sentinel.
.not_empty()BoolTrue if this Form does not yield EMPTY.
.fallback(*alternatives)SelfThe first of this value and alternatives that is not EMPTY.

From builtins.object:

CallBuildsMeaning
a < bReturn self<value.
a <= bReturn self<=value.
a > bReturn self>value.
a >= bReturn self>=value.

On this page