Thanks for the comment. I totally agree that Python can express this with its functional primitives as well. I was simply using it to show an "imperative style", and Python is my favorite executable pseudo-code.
[P.S: I'm a Python core developer and long-time user; calling Python out is really, really not my thing!]