kurisu6912 commented on issue #326:
URL: https://github.com/apache/tvm-ffi/issues/326#issuecomment-3642066310

   I think the best choice is to add a function `ffi.MapGetItemOrDefault`.
   
   
https://github.com/apache/tvm-ffi/blob/f7e09d6a96b54554190bae0d7ba9ff7a6e9a109e/src/ffi/container.cc#L68-L85
   
   There are many other solutions, but I think the idea is identical.
   
   1. Return a dedicated object to represent NotFound.
   2. Return a tuple of (is_found, value_or_null)
   
   Method 1 silences the error in both the Python side and the C++ Side, which 
violates the Python Zen. Method 2 requires the implementation of a new 
function, since we have to build new ones anyway, why don't we just build 
`MapGetItemOrDefault`?


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