gemini-code-assist[bot] commented on code in PR #50:
URL: https://github.com/apache/tvm-ffi/pull/50#discussion_r2373259112


##########
python/tvm_ffi/container.py:
##########
@@ -119,12 +119,10 @@ def __getitem__(self, idx: SupportsIndex, /) -> T: ...
     @overload
     def __getitem__(self, idx: slice, /) -> Array[T]: ...
 
-    def __getitem__(self, idx: SupportsIndex | slice, /) -> T | Array[T]:
+    def __getitem__(self, idx: SupportsIndex | slice, /) -> T | Array[T] | 
list[T]:

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The return type hint is not quite right. With this change, the 
implementation now returns `T | list[T]`. It no longer returns `Array[T]`. So 
the type hint should be `T | list[T]`.
   
   Additionally, for full consistency, you should also update:
   - The `@overload` for slicing on line 120 to return `list[T]`.
   - The docstring on line 123 to mention that a `list` is returned for a slice.
   
   ```suggestion
       def __getitem__(self, idx: SupportsIndex | slice, /) -> T | list[T]:
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to