News for hackers. Stuff that matters.
Re:Silly Python riddle by pyre on Tuesday December 20, 2011 @10:33AM (#3373751)
I'm thinking that the parent is expecting 'yield' to return 'None' into g(), and then for g() to return 7 since it doesn't do anything with the 'x' parameter, and is confused why that isn't the case.
Re:Silly Python riddle by martin_k on Tuesday December 20, 2011 @10:56AM (#3373822)
Yes, but I think this is cleared up if you consider that calling a generator function does not execute its body, but return generator object. It doesn't really matter if it's a lambda or a regular named function.