FrozenClass

class deepfos.lib.utils.FrozenClass(name, base, namespace)

不可修改的类

元类,指定此元类的类将不可以设置属性, 不可初始化。

>>> class Frozen(metaclass=FrozenClass):
...     pass
>>> Frozen.x = 1
Traceback (most recent call last):
...
NotImplementedError: Frozen is read-only.
>>> Frozen()
Traceback (most recent call last):
...
NotImplementedError: Frozen cannot be instantiated.
Exclude-members

不可修改的类

元类,指定此元类的类将不可以设置属性, 不可初始化。

>>> class Frozen(metaclass=FrozenClass):
...     pass
>>> Frozen.x = 1
Traceback (most recent call last):
...
NotImplementedError: Frozen is read-only.
>>> Frozen()
Traceback (most recent call last):
...
NotImplementedError: Frozen cannot be instantiated.