Extracting the a value from a tuple when the other values are unused

前端 未结 6 1290
一整个雨季
一整个雨季 2021-02-04 10:42

I have a tuple foo which contains something I don\'t care about and something I do.

foo = (something_i_dont_need, something_i_need)
<
6条回答
  •  温柔的废话
    2021-02-04 11:14

    If this is a return value from a function or method, another alternative is to write a wrapper function (or subclass the class and add a method) that returns just the item you're interested in, and calling that instead.

提交回复
热议问题