On 7/20/05, Facundo Batista <[EMAIL PROTECTED]> wrote:
> On 7/20/05, Martin Blais <[EMAIL PROTECTED]> wrote:
> 
> > it got me wondering, wouldn't it be nice if
> >
> >    while:
> >       ...
> >
> > behaved as:
> >
> >    while True:
> 
> -1
> 
> Explicit is better than implicit.

Well, maybe you're reading a bit too litterally into that statement. 
To me the expression is very explicitly absent :-)    More seriously,
reading into these rules too literally leads to funny places: I could
ask why at the end of functions there is an implicit "return None"
(I'm not expecting an answer).  Explicit better than implicit?

The Rule of Least Surprise says to me that "while:" would do the least
unexpected thing.  There are only two possibilities: the test is
implicitly false, in which case "while:" would make no sense (i.e. the
block would be ignored).  Therefore the other only sensible case is
that the test is implicitly true, which can be useful (and also
happens to be a very common idiom).

It's not so much about saving typing characters: it's just low-hanging
fruit that simplifies the language a little bit (well, "simplify" is
arguable though, if you consider the grammar it makes it a tiny bit
more complex, but that is usually not the programmer's point-of-view).

Bah, whatever, +0

cheers,
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to