Why is a generator expression called a expression?

Veek M veek at dont-use-this.com
Mon Apr 20 05:29:40 EDT 2020


On Mon, 20 Apr 2020 19:19:31 +1000, Chris Angelico wrote:

> In the case of a genexp, the expression has a value which is a generator
> object. When you pass that to all(), it takes it and then iterates over

but an object is NOT THE SAME as it's value! '2' is an object which 
happens to have a value of 2 under certain contexts.. ergo a generator 
object is returned by ( whatever ) and therefore NOT a value-to-be-used!


More information about the Python-list mailing list