IMO if someone is motivated to get a new container type in Python, a
PEP is required.

A PEP has been written for the new removeprefix() and removesuffix()
methods which are way simpler ;-)

I expect many questions on corner cases for a sorted container type.

Having a reference implementation, even written in Python, would be helpful.

Victor

On Wed, Nov 10, 2021 at 1:00 AM Bob Fang <boyuf...@bytedance.com> wrote:
>
> Hi All,
>
> This is a modest proposal to consider having sorted containers 
> (http://www.grantjenks.com/docs/sortedcontainers/) in standard library. I 
> know that usually adding stuff to standard library requires some strong 
> arguments, so I will try my best to give my reasons here:
>
> 1) Some mainstream language support them out of box: C++ for example have 
> set/map which are sorted by the key order, and Java has TreeMap which is 
> internally a Red-black tree. I understand languages might target different 
> audiences, but I think Python’s standard library is quite extensive compared 
> to peers. Consider we even have a sqlite driver in the stdlib, I do not think 
> it is outrageous to have sorted containers.
> 2) These containers are not really easy to implement correctly, and usually 
> is out of the scope of day-to-day projects. Especially considering we have a 
> large audience of non-hardcore programmers in Python community. They may have 
> the need to use these structures, but they do not necessarily have the 
> skill/knowledge to implement it.
> 3) Granted, people can just pip install this library, but that is one extra 
> step and less fraction is better for user experience.
> 4) These structures are very useful in competitive programming, I know at 
> least in Leetcode this library is installed for Python.
> 5) The said library is of high implementation quality.
>
> I might be stupid here as I am not the maintainer of this library and I might 
> be not even in a position to submit it to Python as part of stdlib, but here 
> are some of my personal thoughts and would love to hear your opinion!
>
> Thanks!
> Bob
>
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-dev@python.org/message/YB2JD477TKPB2HTXDW6ZXUBD6NFFFHHJ/
> Code of Conduct: http://python.org/psf/codeofconduct/



-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/X5AXOUUHN7HBTMIQZQTR5LCNSQJGY27B/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to