[Python-ideas] get() method for list and tuples

Paul Moore p.f.moore at gmail.com
Sun Mar 5 18:22:33 EST 2017


On 5 March 2017 at 19:13, Ed Kellett <edk141 at gmail.com> wrote:
>> I think we're going to have to just disagree. You won't convince me
>> it's worth adding list.get unless you can demonstrate some *existing*
>> costs that would be removed by adding list.get, and showing that they
>> are greater than the costs of adding list.get (search this list if you
>> don't know what those costs are - I'm not going to repeat them again,
>> but they are *not* trivial).
>
>
> They seem to be "it'd need to be added to Sequence too" and "it would mess
> with code that checks for a .get method to determine whether something is a
> mapping". It's easily implementable in Sequence as a mixin method, so I'm
> prepared to call that trivial, and I'm somewhat sceptical that the latter
> code does—let alone should—exist.
>

You didn't seem to find the post(s) I referred to. I did a search for
you. Here's one of the ones I was talking about -
https://mail.python.org/pipermail/python-ideas/2017-February/044807.html

You need to present sufficient benefits for list.get to justify all of
the costs discussed there - or at least show some understanding of
those costs and an appreciation that you're asking *someone* to pay
those costs if you expect a proposal to add *anything* to the Python
language seriously.

But I quit at this point - you seem intent on not appreciating the
other sides of this argument, so there's not really much point
continuing.
Paul

PS And yes, I do appreciate your point here - a get method on lists
may be useful. And helpers (if you don't name them well, for instance)
aren't always the best solution. But I've never yet seen *any* code
that would be improved by using a list.get method, so although I
understand the argument in theory, I don't see the practical benefits.


More information about the Python-ideas mailing list