{ } Raw JSON

bundles / traitlets 5.15.0 / traitlets / traitlets / Set / __init__

function

traitlets.traitlets:Set.__init__

source: /traitlets/traitlets.py :3662

Signature

def   __init__ ( self trait : t.Any = None default_value : t.Any = traitlets.Undefined minlen : int = 0 maxlen : int = 9223372036854775807 ** kwargs : t.Any )  →  None

Summary

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

Extended Summary

The default value is created by doing set(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 = Set({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.

minlen : Int [ default 0 ]

The minimum length of the input list

maxlen : Int [ default sys.maxsize ]

The maximum length of the input list

Aliases

  • traitlets.Set.__init__