No "side effect" assignment!
Christopher A. Craig
list-python at ccraig.org
Mon Sep 15 09:24:52 EDT 2003
afriere at yahoo.co.uk (Asun Friere) writes:
> I am alone in feeling some slight unease at the sight of "while 1: ...
> break"? I know this is considered somewhat pythonic, but apart from
> the fact that there is only a single assignment statement is there
> really any advantage to be gained by doing it this way? It seems to
> be trading one aesthetic disadvantage for another, and imho, a
> marginally less legible one.
While I agree with you, I don't think I'd bother with changing thel
language now to fix it. If I were writing a new language I'd prefer a
loop-and-a-half structure something like this:
repeat:
stuff
while test:
stuff
I'd really prefer something like the above without the second colon.
While it's nice to have the condition dedented for readability, it
isn't really starting a new block. At any rate, I don't think adding
this to the current language is worth it, so I'll keep using "while 1:
break" structures and translating to the above in my head.
--
Christopher A. Craig <list-python at ccraig.org>
"So we who are many, are one body in Christ, and individually members
one of another." Romans 12:5 (NASB)
More information about the Python-list
mailing list