Improved Sequences

This commit is contained in:
2022-09-14 23:01:52 +02:00
parent f0ed0bd2e1
commit 52069b7bb3
6 changed files with 50 additions and 47 deletions

View File

@@ -15,21 +15,21 @@ class IterableABC(SequenceABC, QueryableABC):
SequenceABC.__init__(self, t, values)
def __getitem__(self, n) -> object:
r"""Gets item in enumerable at specified zero-based index
return self.to_list().__getitem__(n)
Parameter
--------
n: the index of the item to get
def __delitem__(self, i: int):
"""Delete an item"""
_l = self.to_list()
del _l[i]
self._values = SequenceValues(_l, self._type)
Returns
-------
The element at the specified index.
def __setitem__(self, i: int, value):
_l = self.to_list()
_l.__setitem__(i, value)
self._values = SequenceValues(_l, self._type)
Raises
------
IndexError if n > number of elements in the iterable
"""
return list.__getitem__(self.to_list(), n)
def __str__(self):
return str(self.to_list())
def append(self, __object: object) -> None:
r"""Adds element to list