for / while else doesn't make sense

Steven D'Aprano steve at pearwood.info
Sat May 21 07:26:22 EDT 2016


On Sat, 21 May 2016 04:03 pm, Marko Rauhamaa wrote:

> theherk at gmail.com:
> 
>> You seem to have missed the point. Nobody is suggesting, I don't
>> believe, that all of a language should be intuitive. Rather that if
>> any part of it is unnecessarily counter-intuitive, it may be worth
>> looking for a better solution. Python is a very well designed language
>> when it comes to in linguistic presentation. In this case however, it
>> is not only unintuitive but counter-intuitive.
> 
> The for-else construct is a highly practical feature. It is in no way
> inherently counter-intuitive. As any new thing, it needs to be learned
> and used to be appreciated.

Yes, this!

I might have issues with the keyword chosen, but the feature itself is very
clever.

Does anyone know of other languages that include the same feature? It's very
rare for Python to innovate in language features.

(I wonder if it came from ABC?)





-- 
Steven




More information about the Python-list mailing list