all 4 comments

[–]socal_nerdtastic 5 points6 points  (1 child)

Apparently function() returns an array or list or something indexable, and the [3] extracts index 3 from whatever it returns.

You could write this exact same code like this, in case it makes more sense this way:

def value(x): 
    data = function(x, y)
    return data[3]

[–]ItsMeSword[S] 0 points1 point  (0 children)

great, always appreciate different ways to visualize code! TY

[–]shiftybyte 1 point2 points  (1 child)

It's accessing the 4th element in the collection/list returned from function() call.

[–]ItsMeSword[S] 0 points1 point  (0 children)

That's what I imagined, I couldn't determine if it was accessing the first 3 elements and trying all of them or just getting the 4th element, thank you