[Python-ideas] try-else without except or finally
Yuval Greenfield
ubershmekel at gmail.com
Thu Nov 10 20:00:54 CET 2011
On Thu, Nov 10, 2011 at 3:28 PM, Steven D'Aprano <steve at pearwood.info>wrote:
> Yuval Greenfield wrote:
>
> "Try...else..." doesn't make any sense without the except jn my eyes. The
>> "else" has to conjugate something.
>>
>
>
> We already have while...else and for...else blocks in Python. The
> principle is the same:
>
>
> while condition():
> ...
> else:
> # Run the else block unless we exit the while block with a break.
> ...
>
>
I'd rename or remove for/else and while/else from the language. Guido has
said "we probably should not do more of these".
http://mail.python.org/pipermail/python-ideas/2009-October/006083.html
Though these constructs are technically useful, even experts who read the
documentation misunderstand or misuse them. People who are new to the
language will be even worse.
--Yuval
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20111110/a6fc4386/attachment.html>
More information about the Python-ideas
mailing list