get_nested
This commit is contained in:
@@ -44,3 +44,12 @@ class HookedContainer(ABC, Sized, Iterable[T], Container[T]):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def insert(self, index, value): ...
|
def insert(self, index, value): ...
|
||||||
|
|
||||||
|
# Custom Methods
|
||||||
|
|
||||||
|
def get_nested(self, keys):
|
||||||
|
"""Recursively call __getitem__ with each key in the iterable."""
|
||||||
|
result = self
|
||||||
|
for key in keys:
|
||||||
|
result = result[key]
|
||||||
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user