W
Wayne Folta
Two observations about PEP-315:
1. It's clever, addresses a definite "wart", and is syntactically
similar to try/except. But it's syntax seems like an acquired taste to
me.
2. It is a very general construct, which might be what is called for.
But I wonder if most of the time it would be used to accomplish
something like:
while 1:
line = sys.stdin.readline()
if line == "\n":
break
In a neater way? How about, instead, creating an "until" loop:
until line == "\n":
line = sys.stdin.readline()
Would be defined to work exactly like a while loop except the test is
not evaluated the first time through the loop. Wouldn't this be akin to
checking at the end of the loop, while maintaining a more while-ish
syntax?
Is this at all useful or is something of the order of PEP-315 the way
to go?
1. It's clever, addresses a definite "wart", and is syntactically
similar to try/except. But it's syntax seems like an acquired taste to
me.
2. It is a very general construct, which might be what is called for.
But I wonder if most of the time it would be used to accomplish
something like:
while 1:
line = sys.stdin.readline()
if line == "\n":
break
In a neater way? How about, instead, creating an "until" loop:
until line == "\n":
line = sys.stdin.readline()
Would be defined to work exactly like a while loop except the test is
not evaluated the first time through the loop. Wouldn't this be akin to
checking at the end of the loop, while maintaining a more while-ish
syntax?
Is this at all useful or is something of the order of PEP-315 the way
to go?