Apr-13-2019, 09:26 PM
(This post was last modified: Apr-13-2019, 09:26 PM by Gribouillis.)
chakox Wrote:i don't understand why the other method work only in the interpreter.When you run code in the interactive interpreter, it prints the result of every statement (if not None). In this case, it prints the result of
gen2.send(58)
, which is the next value produced by yield. In a file you don't see the result because there is no call to print(). Consider this>>> x = y = 1 >>> x + y 2The same code in a file doesn't display the 2.