Immutable
is a class designed to create immutable instances. The attributes of any subclass of Immutable
will be read-only.
Create a subclass of Immutable
and initialise it:
class Dog(Immutable):
def __init__(self, name, colour):
super(TetrisPiece, self).__init__(attrs_dict={
"name": name,
"colour": colour
})
misty = Dog("Misty", "black")
- Install Python 3
python3 -m venv venv
pip install
nosetests