paleolimbot commented on code in PR #340:
URL: https://github.com/apache/arrow-nanoarrow/pull/340#discussion_r1447987186


##########
python/src/nanoarrow/_lib_utils.py:
##########
@@ -74,17 +79,134 @@ def array_repr(array, indent=0):
     else:
         lines.append(f"{indent_str}- dictionary: NULL")
 
-    children = array.children
-    lines.append(f"{indent_str}- children[{len(children)}]:")
-    for child in children:
+    lines.append(f"{indent_str}- children[{array.n_children}]:")
+    for child in array.children:
         child_repr = array_repr(child, indent=indent + 4)
         lines.append(f"{indent_str}  {repr(child.schema.name)}: {child_repr}")
 
     return "\n".join(lines)
 
 
+def schema_view_repr(schema_view):
+    lines = [
+        "<nanoarrow.c_lib.CSchemaView>",
+        f"- type: {repr(schema_view.type)}",
+        f"- storage_type: {repr(schema_view.storage_type)}",
+    ]
+
+    for attr_name in sorted(dir(schema_view)):
+        if attr_name.startswith("_") or attr_name in ("type", "storage_type"):
+            continue
+
+        attr_value = getattr(schema_view, attr_name)
+        if attr_value is None:
+            continue
+
+        lines.append(f"- {attr_name}: {repr(attr_value)}")
+
+    return "\n".join(lines)

Review Comment:
   I see you got there, but the SchemaView doesn't know about children 
(although there should definitely be a class that *does* have all that 
information, it's just not implemented yet).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to