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

Chris Angelico rosuav at gmail.com
Sat Feb 22 04:57:28 CET 2014

On Sat, Feb 22, 2014 at 12:10 PM, Glenn Linderman <v+python at g.nevcal.com> wrote:
> Here's a challenge: There has been a big thread about None versus (SQL)
> Null. Show how an except: expression can help the DB API more easily convert
> from using None to using a new Null singleton, and you'll have a winner :)

Heh! I'm not entirely sure how that would work, as I've only skimmed
the DB API thread, but I understand part of it is to do with sorting.
I'm not sure how you could embed an except-expression into that
without either changing the sort function or potentially doing part of
the sort twice:

lst = sorted(stuff) except TypeError: sorted(stuff, key=keyfunc)

at which point you may as well go straight to the key= form from the start.


More information about the Python-Dev mailing list