junrushao commented on PR #454: URL: https://github.com/apache/tvm-ffi/pull/454#issuecomment-3919283685
> The default behavior of python atm is simply expand. Expansion also could make sense for cases like immutable data structure. Say a shape value get reference in multiple places beause of the way we copy the data structure > > ```python > x = (1,2,3) > y = (1,4) > > print([y, y]) > > [(1,4), (1,4)] > > # circle case > x = [12] > x.append(x) > > [12, [...]] > ``` > > This being said, there can be value in cases where we might want duplicated value printing. Perhaps we can do it under a flag. Behavior from the latest commit: ``` import tvm_ffi as ffi from tvm_ffi._ffi_api import ReprPrint x = ffi.List([12]) x.append(x) print(ReprPrint(x)) # gives: [12, ...] y = ffi.Array((1,4)) y = ffi.Array((y, y)) print(ReprPrint(y)) # gives: ((1, 4), (1, 4)) ``` @tqche LMK if it looks good to you -- 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]
