Lunderberg commented on PR #17206: URL: https://github.com/apache/tvm/pull/17206#issuecomment-2258553585
> So, my question is why do we want to name unused variables in general? Could we not just use `_`? Mainly to indicate to a reader which return values are being ignored. As an example, suppose there's a function that produces a ```python # A reader may not know what the first two return values are. _, _, attrs = define_function(relax_args) # The first two return values are a function and parameters to # that function. _func, _params, attrs = define_function(relax_args) ``` I've run into a few cases where the same return value was re-generated, because a later developer wasn't aware that it was already being generated. By explicitly naming the unused return value, this becomes less likely. (e.g. Seeing `_func` instead of `_`, and checking whether it is already the function that should be used.) Obviously, this shouldn't be applied in all cases, as `_, y = get_xy()` is already perfectly readable, but it can help in cases where it isn't as clear. -- 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]
