[Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

Ethan Furman ethan at stoneleaf.us
Wed Mar 12 18:40:59 CET 2014


On 03/12/2014 10:09 AM, Guido van Rossum wrote:
>
> I want to reject this PEP.  [...]
>
> But the thing I can't get behind are the motivation and rationale. I don't think that e.g. dict.get() would be
> unnecessary once we have except expressions, and I disagree with the position that EAFP is better than LBYL [...]

Does this mean a better motivation and rationale may cause you to change your mind?

My motivation is for simpler, easier to read code:  instead of a full-blown try/except block or a double-lookup into an 
indexable object I would much rather do:

     self.date = text_to_date(date, 'mdy') except ValueError: batch_date

instead of:

     try:
         self.date = text_to_date(date, 'mdy')
     except ValueError:
         self.date = batch_date


> This is probably the most you can get out of me as far as a pronouncement. Given that the language summit is coming up
> I'd be happy to dive deeper in my reasons for rejecting it there (if there's demand).

I would like to know, but I won't be at the language summit.  I can wait until after, though --  I know time is in 
especially short supply until then.

--
~Ethan~


More information about the Python-Dev mailing list