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


##########
python/src/nanoarrow/_lib.pyx:
##########
@@ -630,65 +574,71 @@ cdef class Array:
 
     @property
     def null_count(self):
+        self._assert_valid()
         return self._ptr.null_count
 
+    @property
+    def n_buffers(self):
+        self._assert_valid()
+        return self._ptr.n_buffers
+
     @property
     def buffers(self):
+        self._assert_valid()
         return tuple(<uintptr_t>self._ptr.buffers[i] for i in 
range(self._ptr.n_buffers))
 
+    @property
+    def n_children(self):
+        self._assert_valid()
+        return self._ptr.n_children
+
+    def child(self, int64_t i):
+        self._assert_valid()
+        if i < 0 or i >= self._ptr.n_children:
+            raise IndexError(f"{i} out of range [0, {self._ptr.n_children})")
+        return CArray(self._base, <uintptr_t>self._ptr.children[i], 
self._schema.child(i))
+
     @property
     def children(self):
-        return ArrayChildren(self)
+        for i in range(self.n_children):
+            yield self.child(i)
 
     @property
     def dictionary(self):
         self._assert_valid()
         if self._ptr.dictionary != NULL:
-            return Array(self, <uintptr_t>self._ptr.dictionary, 
self._schema.dictionary)
+            return CArray(self, <uintptr_t>self._ptr.dictionary, 
self._schema.dictionary)
         else:
             return None
 
     def __repr__(self):
-        return array_repr(self)
-
-
-cdef class ArrayView:
-    """ArrowArrayView wrapper
-
-    The ArrowArrayView is a nanoarrow C library structure that provides
-    structured access to buffers addresses, buffer sizes, and buffer
-    data types. The buffer data is usually propagated from an ArrowArray
-    but can also be propagated from other types of objects (e.g., serialized
-    IPC). The offset and length of this view are independent of its parent
-    (i.e., this object can also represent a slice of its parent).

Review Comment:
   I just moved the docstring to `c_lib.c_array_view()` (where it's a little 
easier for IDEs to find)



-- 
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