3 ms·
Thanks for pointing that out, I think I fixed it. Not well tested ;) I'm not sure if the way that you're using yield within the if and while statements works c
by glxxyz 7y ago
Thanks for pointing that out, I think I fixed it. Not well tested ;)
I'm not sure if the way that you're using yield within the if and while statements works correctly. I like the idea of replacing state transitions with method calls but you'll run into recursion depth problems with a state machine that alternates between two states.
- OJFord 7y ago> I'm not sure if the way that you're using yield within the if and while statements works correctly. You're right... Perhaps I'm not so surprised that `if yield == val:` is a SyntaxError, but that `yield` can't be used as an rvalue to a walrus operator (that the `while` example essentially boils down to) surprises me: >>> char = yield File "<stdin>", line 1 SyntaxError: 'yield' outside function >>> >>> # i.e. OK, that's the error we want if it works >>> >>> got_b = (char := yield) == 'b' File "<stdin>", line 1 got_b = (char := yield) == 'b' ^ SyntaxError: invalid syntax