A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2014-March/133105.html below:

[Python-Dev] Why not make frames? [was: Alternative forms [was: PEP 463: Exception-catching expressions]]

[Python-Dev] Why not make frames? [was: Alternative forms [was: PEP 463: Exception-catching expressions]]Ethan Furman ethan at stoneleaf.us
Wed Mar 12 01:58:23 CET 2014
On 03/09/2014 07:16 PM, Jim J. Jewett wrote:
>
> because I cannot imagine reading an embedded version of either of those
> without having to mentally re-parse at the colon.  An example assuming
> a precedence level that may not be what the PEP proposes:
>
>      if myfunc(5, expr1 except expr2: expr3, "label"):
>          for i in range(3, 3*max(data) except TypeError: 9, 3):
>             ...
>
>      if myfunc(5, (expr1 except expr2: expr3), "label"):
>          for i in range(3, (3*max(data) except TypeError: 9), 3):
>             ...
>
>      if myfunc(5, expr1 except (expr2: expr3), "label"):
>          for i in range(3, 3*max(data) except (TypeError: 9), 3):
>             ...
>
>      if myfunc(5, expr1 except (expr2: expr3), "label"):
>          for i in range(3, 3*max(data) (except TypeError: 9), 3):
>             ...
>
>      if myfunc(5, expr1 except (expr3 if expr3), "label"):
>          for i in range(3, 3*max(data) (except 9 if TypeError), 3):
>             ...
>
>      if myfunc(5, expr1 except (expr3 if expr3), "label"):
>          for i in range(3, 3*max(data) except (9 if TypeError), 3):
>
>      myarg = expr1 except (expr3 if expr2)
>      if myfunc(5, myarg, "label"):
>          limit = 3*max(data) except (9 if TypeError)
>          for i in range(3, limit, 3):
>
> Yes, I would prefer to create a variable naming those expressions,
> but these are all still simple enough that I would expect to have
> to read them.  (I like constructions that get ugly just a bit faster
> than they get hard to understand.)  If I have to parse any of them,
> the ones at the bottom are less difficult than the ones at the top.

I totally disagree.  I found the second one the easiest to read, and outside a function call (or other complexity, the 
parens wouldn't be needed.

--
~Ethan~
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