On Sun, 5 Mar 2017 at 14:08 Paul Moore <p.f.mo...@gmail.com> wrote:

> Self-evidently no. But what does that prove? That we should implement
> list.get? You could use the dientical argument for *anything*. There
> needs to be another reason for implementing it.
>

I don't think that's true. It's not true for many other list methods, for
example. It's not a reason for implementing it, but it does suggest to me
that it would increase the one-obvious-way-to-do-it-ness of the language.

But you have yet to explain why you'd be glad not to write a helper
> for list.get, in any terms that don't simply boil down to "someone
> else did the work for me".
>

What? Five lines isn't work, it's just ugly. I don't want to add a lot of
random utility functions like this because it drastically increases the
effort required to read my code. It's hardly any effort, but it doesn't
solve any problems, so why bother?

The point about this as a Python change is that it's a standard. Who does
the work couldn't be less relevant; what matters is that it would add a
consistent and easy spelling for something that doesn't have one.


> 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.


> And I don't seem to be able to convince
> you that writing a helper function is a reasonable approach.
>

I feel like I'm saying this a lot, but writing helper functions has its own
readability cost. I'm not trying to get anyone to implement list.get, I'm
trying to get it centrally documented and allowed into list's
overly-mappingproxied namespace.

Ed
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to