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/2009-August/091042.html below:

[Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

[Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308) [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)Jeff McAninch mcaninch at lanl.gov
Thu Aug 6 04:11:28 CEST 2009
Raymond Hettinger wrote:
> If accepted, this would also solve the feature requests for various 
> functions to have default arguments.
> For example:
>
>   x = min(seq) except ValueError else 0     # default to zero for 
> empty sequences
>
> It would also be helpful in calculations that have algebraic 
> restrictions:
>
>  sample_std_deviation = sqrt(sum(x - mu for x in seq) / (len(seq)-1)) 
> except ZeroDivisionError else float('Inf')
>
>
> Raymond
Yes, exactly the situations I keep coding around.

-- 
==========================
Jeffrey E. McAninch, PhD
Physicist, X-2-IFD
Los Alamos National Laboratory
Phone: 505-667-0374
Email: mcaninch at lanl.gov
==========================

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