{ } Raw JSON

bundles / traitlets 5.16.2 / traitlets / traitlets / TraitType / __init__

function

traitlets.traitlets:TraitType.__init__

source: /traitlets/traitlets.py:554

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__