Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A sorted mapping object

Project description

A sorted mapping object.

sortedmap is a python dict api interface to the C++ std::map type. sortedmap implements the full dict object interface with a few differences:

  1. Objects are stored in a red black tree. All keys must be comparable to eachother though they do not need to be hashable. This means all keys must implement at least __lt__ and __eq__.
  2. O(log(n)) lookup, insert, and deletes because of the red- black tree backing. This is worse than dict which offers O(1) lookup, insert, and delete. The C++ implementation offers low constants
  3. popitem accepts a first=True argument which says to pop from the front or the back. dict.popitem pops an abitrary item; however sortedmap pops the first or the last item.


sortedmap has no python package depencencies but requires CPython 2.7 or >=3.4. sortedmap depends on CPython 2 or 3 and some means of compiling C++14. We recommend using g++ to compile sortedmap. Compilation and testing was done with gcc 5.3.0


sortedmap is free software, licensed under the GNU Lesser General Public License, version 2.1. For more information see the LICENSE file.


Source code is hosted on github at

Project details

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
sortedmap-0.1.0.tar.gz (19.1 kB) Copy SHA256 hash SHA256 Source None Feb 8, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page