Skip to main content

Container Types: List

schema.list

Declares a schema for a list.

from d42 import schema

sch = schema.list

schema.list(elements)

Declares a schema for a list of values that conform to the specified schema.

from d42 import schema

sch = schema.list([schema.int, schema.int])

schema.list(type)

Declares a schema for a list. The constructor takes a schema object representing the type of the list elements.

from d42 import schema

sch = schema.list(schema.int)

info

The schema.list type also supports the .len(length) method, similar to the schema.str.len(length) method.