while true: !!!

Alex Martelli aleaxit at yahoo.com
Mon Dec 18 15:16:19 EST 2000


"Darren New" <dnew at san.rr.com> wrote in message
news:3A3E4C55.9C785306 at san.rr.com...
    [snip]
> > Few languages equate 'success' (not raising an exception, for
> > languages where 'exception' means something) with 'a boolean
> > result' (Icon is rather oriented that way, but that's because
> > it _backtracks_ over 'insuccess' -- a very different setup
> > than Python's).
>
> Actually, it's not *quite* like that. "if" in Icon is true for *any*
result.
> It's only the "no result" that invokes the else part. A failure/exception
in
> Icon is more like partial functions in math, where it's possible there are
> inputs which generate no results at all.  One of the cleaner ways of
> handling it I've seen.

If we want to get into Icon details...: the general case is a
*sequence* of results, if/when the expression gets resumed
(the backtracking I mentioned -- but also explicitly, in
'every') to generate more.  'no _more_ results' (which holds
from the start for an empty result-sequence) is if's 'false'
meaning (also while's, of course).

It's cool semantics, but if you've ever tried to explain to a
programming beginner the difference between every and
while, you might be slightly less enthusiastic about it:-).


Alex






More information about the Python-list mailing list