On Fri, 21 Feb 2014 14:15:59 +1100
Chris Angelico <ros...@gmail.com> wrote:
> 
> A number of functions and methods have parameters which will cause
> them to return a specified value instead of raising an exception.  The
> current system is ad-hoc and inconsistent, and requires that each
> function be individually written to have this functionality; not all
> support this.

While I sympathize with the motivation, I really don't like the end
result:

>     lst = [1, 2]
>     value = lst[2] except IndexError: "No value"

is too much of a break from the usual stylistic conventions, and looks
like several statements were stuffed on a single line.

In other words, the gain in concision is counterbalanced by a loss in
readability, a compromise which doesn't fit in Python's overall design
principles.

(compare with "with", which solves actual readability issues due to the
distance between the "try" and the "finally" clause, and also promotes
better resource management)

So -0.5 from me.

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to