Skip to content
Snippets Groups Projects
Commit 54f368c7 authored by Andreas Klöckner's avatar Andreas Klöckner Committed by Andreas Klöckner
Browse files

map_array_container: Use execption to decide whether we have a container

parent 634f4add
No related branches found
No related tags found
No related merge requests found
Pipeline #175143 passed
......@@ -166,12 +166,13 @@ def map_array_container(
:param ary: a (potentially nested) structure of :class:`ArrayContainer`\ s,
or an instance of a base array type.
"""
if is_array_container(ary):
return deserialize_container(ary, [
(key, f(subary)) for key, subary in serialize_container(ary)
])
else:
try:
ser_ctr = serialize_container(ary)
except TypeError:
return f(ary)
else:
return deserialize_container(ary, [
(key, f(subary)) for key, subary in ser_ctr])
def multimap_array_container(f: Callable[..., Any], *args: Any) -> Any:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment