Arnabesh Samadder
Arnabesh Samadder

Reputation: 3

min() function in python3

It seems that the inbuilt min() function for determining the minimum value in a given iterable. I have this line of code:

result = min(cost+futureCost(newState) \
                for action, newState, cost in problem.succAndCost(state))

where newState is of integer type and the function futureCost() returns an integer. How the enclosed parameters form an iterable in this case?

Upvotes: 0

Views: 83

Answers (1)

Bill Lynch
Bill Lynch

Reputation: 82026

This is called a generator expression. https://www.python.org/dev/peps/pep-0289

Upvotes: 2

Related Questions