"""Module with a class object which represent object lists."""
__all__ = ["ObjectList"]
[docs]
class ObjectList(list):
"""List with a default object used to type it when it is empty.
Attributes
----------
default : object
Default object class to use to type the list, if it is empty
"""
[docs]
def __init__(self, object_list: list[object], default: object) -> None:
"""Initialize the list and the default value.
Parameters
----------
object_list : list[object]
Object list
default : object
Default object class to use to type the list, if it is empty
"""
# Initialize the underlying list
super().__init__(object_list)
# Store the default object class
self.default = default