give small real life example? 😬
def get_first(x): return x[0] t = [(3,4), (1,2)] # these two are equivalent sorted(t, key=get_first) sorted(t, key=lambda x: x[0])
Function creates its own namespace, holds label for localisation. This overhead can be reduced by using lamda function. I hope this addresses your query.
Обсуждают сегодня