Improved list to handle typing
This commit is contained in:
@@ -10,3 +10,9 @@ class List(Iterable):
|
||||
|
||||
if values is not None:
|
||||
self.extend(values)
|
||||
|
||||
def append(self, __object: object) -> None:
|
||||
if self._type is not None and type(__object) != self._type and not isinstance(type(__object), self._type):
|
||||
raise Exception(f'Unexpected type: {type(__object)}')
|
||||
|
||||
super().append(__object)
|
||||
|
Reference in New Issue
Block a user