Why is a generator expression called a expression?

Barry Scott barry at barrys-emacs.org
Tue Apr 21 16:10:40 EDT 2020



> On 20 Apr 2020, at 10:29, Veek M <veek at dont-use-this.com> wrote:
> 
> 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!

In computer software there are lots of objects that are not simple things
like the integer 2. All of these objects can be values and are called values.

A value is not limited to only being integers for example.

Barry



> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list