I didn't know the convention that _ is used as any superfluous assignment.
So I can write `_ = a; a = b; b = _` for integer swap?


On Mon, Nov 23, 2015 at 7:28 PM, Seth wrote:

> Why not simply
>
> _, x, _, y = f()
>
> ? This seems easier to read and understand. _ is a valid variable but is
> typically used for superfluous assignment.
>
>
> On Monday, November 23, 2015 at 9:56:27 AM UTC-8, Sisyphuss wrote:
>>
>> OK, so if I have a function which returns a tuple (a,b,c,d),
>> but I only want the 2nd and 4th value, the most concise way is
>>
>> (x,y) = f()[[2;4]]
>>
>>

Reply via email to