Short syntax for try/pass

Ned Batchelder ned at nedbatchelder.com
Tue Oct 14 16:28:11 CEST 2014


On 10/14/14 10:08 AM, Leonardo Giordani wrote:
> Would it be feasible to propose a short syntax like this?
>
> pass SomeException:
>    somecode
>
> where the above example would become:
>
> pass IndexError:
>   lst[0] = lst[0] + 1
>
> I could not find if such a syntax has been already discussed elsewhere,
> so please let me know if this is the case.
>
> Otherwise, what do you think about it?

PEP 463 proposes a short syntax for this use case: 
http://legacy.python.org/dev/peps/pep-0463/

I'm not sure what became of it.

-- 
Ned Batchelder, http://nedbatchelder.com




More information about the Python-list mailing list