[Python-3000] Stackable Blocks
Crutcher Dunnavant
crutcher at gmail.com
Sun Apr 23 23:40:48 CEST 2006
Having been shot down so hard on my request to bring for loops into
symetry with list comprehensions, I have a new proposal - stackable
blocks.
This is a very _small_ amount of syntax sugar, the basic idea is that
any block headers can be stacked on the same line. This changes no
semantics, nor does it change ordering, or add new keywords, it just
changes a tiny bit of the grammar for whitespace/block parsing.
So for instance this:
for file in open_files:
if file.readable():
...
can be spelled like this.
for file in open_files: if file.readable():
...
And this:
for i in range(10):
for j in range(20):
if i != j:
...
can be spelled:
for i in range(10): for j in range(20): if i != j:
...
and this:
for line in open(file):
if line.strip():
...
can be this:
for line in open(file): if line.strip():
...
--
Crutcher Dunnavant <crutcher at gmail.com>
littlelanguages.com
monket.samedi-studios.com
More information about the Python-3000
mailing list