A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-July/054793.html below:

[Python-Dev] Chaining try statements: eltry?

[Python-Dev] Chaining try statements: eltry? [Python-Dev] Chaining try statements: eltry?Thomas Lotze thomas at thomas-lotze.de
Sat Jul 9 15:54:17 CEST 2005
Nick Coghlan wrote:

> I don't think that's a good idea. What would the following monstrosity
> mean?:
> 
>    if 0:
>        print "Ran the if"
>    else for item in (1, 2, 3):
>        print item
>    else try:
>        print "No exception here!"
>    except:
>        pass
>    else:
>        print "Who's else is this, anyway?"

It is unambiguous. But:

> The use-case of 'elif' or 'else if' to avoid nested if statements is
> strong, but the use cases for the ability to mix compound statements
> together is significantly weaker.

This is not even about use cases anymore, it's about usability.
Indentation (by indicating nesting) serves well to recognize at first
sight what belongs together, and what doesn't. Mixing compound statements
breaks this, as it requires the reader to think about it twice, if that's
even enough.

-- 
Thomas


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4