Whoa Man
This section of the Python docs blows my mind in a unique way.
How many code sections in Sigma could be refactored to take advantage of this delightful grammar?
Anything that looks like this is a top candidate, and I know I’ve written a bunch of loops like that.
For those for whom something like Python documentation induces vomiting:
Modern computer languages are completely incredible in the way they permit expression… expression! Meaning things are more like a dialogue and less like a bunch of control sequences like
10 PRINT "HELLO"
20 EXIT
This is especially true for flow control, which is pretty hard to teach a newcomer because you’re teaching them to think like a computer. Things like printing to the screen make sense in an in-out fashion, but once execution paths start looping, skipping, recursing, etc., things get more abstract to an accomplish-the-task mindset.
Languages like Ruby do this with cuteness. Their grammar is very adaptive, kind of fluid. This tends to be how Ruby people think, as well. I’m not dissing Ruby here (although elsewhere in this blog it is available).
Python works very pragmatically. To me it is almost like every programmer in the world was basically given a yes/no vote on each feature, and only the popularly-needed ones were included. I like this feeling very much. It’s like you’re backed up by common sense.