closures - Syntax Query in Python Statement -


[b _, b in sorted(enumerate(arr, 1), key=lambda x: int.__mul__(*x))] 

is list comprehension in python meant sort array in ascending order while using value @ each place multipled 1-based index

so [4, 3, 1] sorted based on [4*1, 3*2, 1*3] giving [1, 4, 3].

i trying understand: 1. how _ in code works 2. how *x multiplies value index (since enumerate has 1 parameter, assuming how 1-based indexing taken care of).


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -