Sorry, it’s a bit hard to explain my question in a title, but basically, I have a list of positions, and each position can be passed through a function to get a number that gives you data about the position. What I want to do is return the position with the lowest data value in the list, but I can’t seem to find a way to do this.
A bit of pseudo code should help:
def posfunc(self,pos):
x,y = pos
return x**2-y
def minpos(self)
returns position with the least x**2-y value
Python is pretty cool :D:
From built-in documentation:
And lambda’s are worth mentioning here:
Is roughly the same, but more readable I think, if you aren’t using
posfuncelsewhere.