[Python-ideas] [Python-Dev] What's the status of PEP 505: None-aware operators?
steve at pearwood.info
Fri Dec 1 05:37:14 EST 2017
On Thu, Nov 30, 2017 at 08:02:08PM +0300, Ivan Pozdeev via Python-ideas wrote:
> My experience with these operators in C# says:
> * They do save "more than a few keystrokes". Even more importantly, they
> allow to avoid double evaluation or the need for a temporary variable
> workaround that are inherent in "<expr> if <expr> else <alternative>"
> * (An alternative solution for the latter problem would be an
> assignment expression, another regularly rejected proposal.)
> * They make it temptingly easy and implicit to ignore errors.
> * They are alien to Python's standard semantics on search failure which
> is to raise an exception rather than return None
Alien, like this?
py> mo = re.match(r'\d:', 'abc')
py> mo is None
Besides, who said this is limited to searching? I don't remember even a
single example in the PEP being about searching.
More information about the Python-ideas