{ } Raw JSON

bundles / traitlets 5.15.0 / traitlets / traitlets / Container / __init__

function

traitlets.traitlets:Container.__init__

source: /traitlets/traitlets.py :3409

Signature

def   __init__ ( self trait : t.Any | None = None default_value : t.Any = traitlets.Undefined help : str | None = None read_only : bool | None = None config : t.Any | None = None ** kwargs : t.Any )  →  None

Summary

Create a container trait type from a list, set, or tuple.

Extended Summary

The default value is created by doing List(default_value), which creates a copy of the default_value.

trait can be specified, which restricts the type of elements in the container to that TraitType.

If only one arg is given and it is not a Trait, it is taken as default_value:

c = List([1, 2, 3])

Parameters

trait : TraitType [ optional ]

the type for restricting the contents of the Container. If unspecified, types are not checked.

default_value : SequenceType [ optional ]

The default value for the Trait. Must be list/tuple/set, and will be cast to the container type.

allow_none : bool [ default False ]

Whether to allow the value to be None

**kwargs : any

further keys for extensions to the Trait (e.g. config)

Aliases

  • traitlets.Container.__init__