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/2014-February/132714.html below:

[Python-Dev] PEP 463: Exception-catching expressions

[Python-Dev] PEP 463: Exception-catching expressions [Python-Dev] PEP 463: Exception-catching expressionsStefan Behnel stefan_ml at behnel.de
Sun Feb 23 20:20:52 CET 2014
Stefan Behnel, 23.02.2014 19:51:
> Cython has typed
> assignments, so a straight forward idea would be to handle TypeErrors in
> assignments like this:
> 
>     cdef str s
>     s = x except TypeError: str(x)

Similar code in Python would be this:

    from array import array
    x = array('i', [1,2,3])
    value = "123"

    x[0] = value except TypeError: int(value)


> However, I guess that would similarly counter the idea of exception
> handling in an *expression*, and the correct and non-ambiguous way to do
> this would be to spell out the try-except block.

Stefan


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