Re:Stop writing lambda expressions in Python
by nikofeyn on Saturday September 29, 2018 @04:49PM
(#18102727)
i know how to use the repl. i moved between computers during comments and wasn't able to inspect my repl session where it originally returned false. as i mentioned, i must have redefined something or shadowed something which caused confusion, and i just didn't realize it at the time.
However, there is another even more direct experiment you could have run at the Python REPL to see what Python expressions return: just type the expression directly at the REPL and see what it prints back at you. In Python 3:
And in Python 2: So, in your test function above, the expression "something" does return itself; it just does it inside the function, and that return value then gets thrown away when the function exits, because you didn't return it from the function itself.