On Wed, Aug 26, 2020 at 1:41 AM Steven D'Aprano <st...@pearwood.info> wrote:

> On Tue, Aug 25, 2020 at 10:22:20AM -0700, Christopher Barker wrote:
>
> > This one is easier than most because it's pretty much a do we or don't we
> > question, with the spelling semantics, all pretty much already decided.
>
> Is it to be added to lists, or lists and tuples? How about range
> objects?
>
>     range(1, 9, 2).get(100)
>
> Strings and bytes?
>
>     "abc".get(100)
>

I think at a minimum it should be in lists and tuples.

I can't see any reason not to add it to range, strings, bytes, deque,
array, etc. beyond implementation effort. I also think it's fine to leave
them out at first.


> Do we require 3rd party sequences to add this as well, in order to
> continue being called sequences?
>

I think this is pretty much the same question as the discussion about ABCs.
It seems like the answer is "no", or at least "not yet".


> > Though I haven't quite seen it said explicitly -- is this proposed to be
> > added to the Sequence ABC?
>
> If so, do we require that it return None as the default, or are types
> permitted to return whatever missing value they see fit?
>

This should be identical to Mapping.get. None isn't required to be the
default missing value - callers can specify any value they want - but None
is the default default, i.e. `def get(self, item, default=None)`. I don't
know of any Mapping or mapping-like class that has a different default
default. If such classes exist, then I guess None is just the default
default default :)
_______________________________________________
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/YWXT5AN2ADFEVEYR34Q2JMFDW6GNO4RG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to