Alex Hall writes:

 > OK, I'll try again. Do people want collections to get a standard 'default'
 > for `__getitem__`?

I don't know.  

 > I don't want mappings to grow a second way to do the same thing,

They're going to get one, is my reading of the "named indicies"
thread.  That is, it looks to me very likely that index notation
(`x[i]`) is going to support keyword arguments (`x[i, k=v]`).  If so,
that's going to be a natural way to support a `default` argument.  I
imagine some people will choose it because they like it, and if there
are enough people who do there will be pressure for it to be TOOWTDI.

 > and I don't want sequences to have a different way to do it from
 > mappings.

I think you have to choose a second way for mappings to get, or have
sequences do it differently, or have redundancy in sequence
operations.

If the index operator supports keyword arguments (I think it likely;
YMMV), you either have to give dict a keyword argument or you have to
give sequences a .get method.  The former redundancy implied for dict
can be justified by backward compatibility with dict and consistency
with sequences.  The latter is just an arbitrary consistency, and I
doubt it will happen.  That's just my guess; I have no power to make
it go either way.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/CV2MZBWRY6SGGWYFGMYBUVYIDAXSGVIT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to