[Python-ideas] get() method for list and tuples
Ethan Furman
ethan at stoneleaf.us
Fri Mar 3 12:06:32 EST 2017
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.
--
~Ethan~
More information about the Python-ideas
mailing list