You are viewing an older version (5.14.3). Go to latest (5.15.0)
{ } Raw JSON

bundles / traitlets 5.14.3 / traitlets / traitlets / TraitType / __init__

function

traitlets.traitlets:TraitType.__init__

source: /traitlets/traitlets.py :507

Signature

def   __init__ ( self : TraitType[G, S] default_value : t.Any = traitlets.Undefined allow_none : bool = False read_only : bool | None = None help : str | None = None config : t.Any = None ** kwargs : t.Any )  →  None

Summary

Declare a traitlet.

Extended Summary

If allow_none is True, None is a valid value in addition to any values that are normally valid. The default is up to the subclass. For most trait types, the default value for allow_none is False.

If read_only is True, attempts to directly modify a trait attribute raises a TraitError.

If help is a string, it documents the attribute's purpose.

Extra metadata can be associated with the traitlet using the .tag() convenience method or by using the traitlet instance's .metadata dictionary.

Aliases

  • traitlets.TraitType.__init__