On Mon, Apr 20, 2020 at 8:26 PM Veek M <v...@dont-use-this.com> wrote: > > but one can do the following > (x for x in 'apple').next() * 2 > > def foo(): > (yield 2) > foo().next() * 3 > > (lambda x: 2)()*4 > > generator expr, yield expr, lambda expression > all require some modification (insertion of a .next or explicit () so > it's quite confusing.. >
I don't know what you mean by "modification", but the lambda expression has a value - and that value is a function. When you call that function, you get another value, which is whatever the function returned. Same with a generator expression. Also, I recommend upgrading to Python 3. Python 2 is end-of-life. ChrisA -- https://mail.python.org/mailman/listinfo/python-list