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/2017-November/150989.html below:

[Python-Dev] What's the status of PEP 505: None-aware operators?

[Python-Dev] What's the status of PEP 505: None-aware operators? [Python-Dev] What's the status of PEP 505: None-aware operators?Tres Seaver tseaver at palladion.com
Thu Nov 30 13:45:07 EST 2017
On 11/29/2017 01:02 PM, Barry Warsaw wrote:

> I don’t know whether I like any of this <wink> but I think a more
> natural spelling would be:
> 
>   val = name.strip()[4:].upper() except (AttributeError, KeyError) as -1
> 
> which could devolve into:
> 
>   val = name.strip()[4:].upper() except KeyError as -1
> 
> or:
> 
>   val = name.strip()[4:].upper() except KeyError # Implicit `as None`

Of all the proposed spellings for the idea, this one feels most "normal" to
me, too (I'm -0 on the idea as a whole).


> I would *not* add any spelling for an explicit bare-except equivalent.
> You would have to write:
> 
>   val = name.strip()[4:].upper() except Exception as -1


Wouldn't that really need to be this instead, for a true 'except:' equivalence:

  val = name.strip()[4:].upper() except BaseException as -1



Tres.
-- 
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com

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