Trait Types

class traitlets.TraitType

The base class for all trait types.

Numbers

class traitlets.Integer

An integer trait. On Python 2, this automatically uses the int or long types as necessary.

class traitlets.Int
class traitlets.Long

On Python 2, these are traitlets for values where the int and long types are not interchangeable. On Python 3, they are both aliases for Integer.

In almost all situations, you should use Integer instead of these.

class traitlets.CInt
class traitlets.CLong
class traitlets.CFloat
class traitlets.CComplex

Casting variants of the above. When a value is assigned to the attribute, these will attempt to convert it by calling e.g. value = int(value).

Strings

class traitlets.CUnicode
class traitlets.CBytes

Casting variants. When a value is assigned to the attribute, these will attempt to convert it to their type. They will not automatically encode/decode between unicode and bytes, however.

Containers

Classes and instances

Miscellaneous

class traitlets.CBool

Casting variant. When a value is assigned to the attribute, this will attempt to convert it by calling value = bool(value).