On Mon, Mar 16, 2020 at 11:36 AM Andrew Barnert <abarn...@yahoo.com> wrote:

> > Note that the OP used the word "semantics", but primarily meant
> "performance characteristics":
>
> IIRC, the C++ specification includes guaranteed performance
> characteristics as part of its library semantics,


Now we are getting into the semantics of the word "semantics" -- beware the
RecursionError!


> so an implementation whose std::map::find takes more than log N time isn’t
> conforming to C++ semantics.


I would argue that it's not conforming to the specification, even if it
does conform to the semantics :-)


> And I don’t think that’s too unreasonable.


Nor do I -- a specification should include something about performance
characteristics, and we certainly wouldn't want to put anything in the
standard library that didn't have reasonable performance for the intended
use cases. After all, you CAN just use the existing ones and call sorted()
all over the place :-)

Anyway, my only point was that we DO want to consider both performance and
semantics here -- a Sorted Dict (or SortedList, or ...) has different use
cases, and thus should have a different semantics (API).

I note that the SortedList, for instance, is not quite a MutableSequence,
as it doesn't make sense to support .append() and .extend() for that. Not
sure if there is anything about a SortedDict that makes it not a
MutableMapping, though.

-CHB


-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
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/BPCRV2TV3PGGYUQZYRGW24KZ3SAS6L32/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to