简体   繁体   English

python3中的min()函数

[英]min() function in python3

It seems that the inbuilt min() function for determining the minimum value in a given iterable.似乎是用于确定给定迭代中的最小值的内置min()函数。 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.其中newState是整数类型,函数futureCost()返回一个整数。 How the enclosed parameters form an iterable in this case?在这种情况下,封闭的参数如何形成可迭代的?

This is called a generator expression.这称为生成器表达式。 https://www.python.org/dev/peps/pep-0289 https://www.python.org/dev/peps/pep-0289

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM