nest_shape
- PlasmaCalcs.tools.arrays.nest_shape(nested_list, is_element=<function looks_flat>)
returns the implied shape for a numpy object array constructed from nested_list.
Only considers 0th element of list(s) (recursively, as needed). Stops when reaching an is_element(obj).To avoid infinite recursion, raise ValueError if current[0] is current (e.g. with strings).(To properly handle strings, provide a more sophisticated is_element than the default value.)is_element: callable of one inputif is_element(obj), stop going deeper into lists.otherwise, append len(obj) to result, then inspect obj[0].(to start, use obj = nested_list.)default (looks_flat) stops when obj is iterable but obj[0] is not.