Last modified 7 years ago
The list of standard YAML tags and corresponding Python types.
!!null '' # None
!!bool 'yes' # bool
!!int '3...' # int or long
!!float '3.14...' # float
!!binary '...base64...' # str
!!timestamp 'YYYY-...' # datetime.datetime
!!omap [ ... ] # list of pairs (note that key uniqueness is not checked)
!!pairs [ ... ] # list of pairs
!!set { ... } # set
!!str '...' # str or unicode (ASCII scalars are converted to str)
!!seq [ ... ] # list
!!map { ... } # dict
The list of Python-specific YAML tags and corresponding Python types. Tags representing complex objects such as class instances are in a separate list. Note that in most cases there are two tags that represent the same Python type (e.g. !!map and !!python/dict). In such cases, standard YAML tags are prioritized, and Python-specific form is added for completeness.
!!python/none '' # None
!!python/bool 'True' # bool
!!python/str '...' # str
!!python/unicode '...' # unicode
!!python/int '123...' # int
!!python/long '123...' # long
!!python/float '3.14...' # float
!!python/complex '1+1j' # complex
!!python/list [ ... ] # list
!!python/tuple [ ... ] # tuple
!!python/dict { ... } # dict
To represent class instances and other complex objects, the following tags are used.
!!python/name:module.name # module.name (types, classes, and functions)
!!python/module:module # module
!!python/object:module.name # module.name instance with the specified attributes
{ ...attributes... }
!!python/object/apply:module.name # reduce protocol
args: [ ... arguments ... ]
kwds: { ... keywords ... }
state: ... state ...
listitems: [ ... listitems ... ]
dictitems: { ... dictitems ... }
!!python/object/apply:module.name # short form of !!python/object/apply
[ ... arguments ... ]
!!python/object/new:module.name # reduce protocol (__new__)
args: [ ... arguments ... ]
kwds: { ... keywords ... }
state: ... state ...
listitems: [ ... listitems ... ]
dictitems: { ... dictitems ... }
!!python/object/new:module.name # short form of !!python/object/new
[ ... arguments ... ]
