"also" to balance "else" ?

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Tue Jun 14 15:31:29 CEST 2005


On Tue, 14 Jun 2005 07:20:06 GMT, rumours say that Andrew Dalke
<dalke at dalkescientific.com> might have written:

>Given the Python maxim of
>  There should be one-- and preferably only one --obvious way to do it.
>
>which of these is the preferred and obvious way?
>
>while f():
>  print "Hello!"
>  if g():
>    break
>else:
>  print "this is a test"
>also:
>  print "this is not a pipe"
>
> -or-
>
>while f():
>  print "Hello!"
>  if g():
>    print "this is a test"
>    break
>else:
>  print "this is not a pipe"

>I prefer the second over the first.

I am not advocating for either side AFA python 2 is concerned (however I
would substitute "then" for "also"), however the second way does not
handle /elegantly/ multiple break points.

I'm +1 for making "else" the target for break in Py3K though, given an
elegant "also"/"then" keyword.
-- 
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...



More information about the Python-list mailing list