Python 3.9 is now generally available.


Verifies property is of expected type.

Can optionally convert value if it is not of the expected type.

It is possible to specify a required field of a specific type in shorthand by merely providing the type. This method is slightly less efficient than providing an explicit type but is not significant unless parsing a large amount of information:

  class Person(Validated):
    ATTRIBUTES = {'name': unicode,
                  'age': int,

However, in most instances it is best to use the type constants:

  class Person(Validated):
    ATTRIBUTES = {'name': TypeUnicode,
                  'age': TypeInt,