1. typing.NamedTuple

from typing import NamedTupleclass Student(NamedTuple):name: straddress: strage: intsex: str>>> tommy = Student(name='Tommy Johnson', address='Main street', age=22, sex='M')>>> tommyStudent(name='Tommy Johnson', address='Main street', age=22, sex='M')

The NamedTuple class is a subclass of tuple.

>>> isinstance(tommy, tuple)True>>> tommy[0]'Tommy Johnson'

using default values

class MaleStudent(Student):sex: str = 'M'  # default value, requires Python >= 3.6.1>>> MaleStudent(name='Tommy Johnson', address='Main street', age=22)MaleStudent(name='Tommy Johnson', address='Main street', age=22, sex='M')  # note that sex defaults to 'M'

2. typing.Optional

3. types.MappingProxyType

>>> from  types import MappingProxyType>>> data = {'a': 1, 'b':2}>>> read_only = MappingProxyType(data)>>> del read_only['a']TypeError: 'mappingproxy' object does not support item deletion>>> read_only['a'] = 3TypeError: 'mappingproxy' object does not support item assignment