On 03.03.2017 18:06, Ethan Furman wrote:
On 03/02/2017 12:36 PM, Sven R. Kunze wrote:
On 01.03.2017 06:34, Ethan Furman wrote:
On the bright side, if enough use-cases of this type come up (pesky
try/except for a simple situation), we may be able
to get Guido to reconsider PEP 463. I certainly think PEP 463 makes
a lot more sense that adding list.get().
It then would make sense to remove .get() on dicts. ;-)
and to remove parameter "default" of max().
and to remove parameter "default" of getattr().
Backwards compatibility, and performance, says no. ;)
try/except expressions are not a silver bullet any more than
try/except blocks. But they can still be very useful.
Totally true. I think both proposals have their merit.
IIRC, Guido rightfully declared that try/except expressions aren't a
good idea. It's better to find more concrete patterns instead of it. And
I still agree with him.
The "default parameter" pattern is such a pattern, and it's vastly used
in the stdlib.
Sven
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/