nustack
ReferenceNuformscollectionsabc

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. INVALID when self is a sentinel.

Example

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

Inherited methods

From nu.lang.forms.Form:

CallBuildsMeaning
.is_empty()BoolTrue if this Form yields the EMPTY sentinel.
.is_invalid()BoolTrue if this Form yields the INVALID sentinel.
.is_sentinel()BoolTrue if this Form yields either sentinel (EMPTY or INVALID).
.not_empty()BoolTrue if this Form does not yield EMPTY.
.not_invalid()BoolTrue if this Form does not yield INVALID.

From builtins.object:

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

On this page