This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

.. image::

Copyright (c) 2015 Will Roberts <>

Licensed under the MIT License (see ``LICENSE.rst`` for details).

Cython interface to red-black trees implemented in C++.

`Red-black trees`_ are a kind of `self-balancing binary tree`_. They
maintain their entries in sorted order and have O(log n) for
insertion, lookup, and deletion. You can read more about red-black
trees `here
<http:"" tuts="" datastructures="" jsw_tut_rbtree.aspx="">`_
and see animations of insertion, lookup, and deletion `here
<https:"" ~galles="" visualization="" redblack.html="">`_.

.. _`Red-black trees`:
.. _`self-balancing binary tree`:

This package provides dictionary and set objects based on
red-black-trees; these can be used as drop-in replacements for the
built-in ``dict`` and ``set`` types, except that they maintain their
contents in sorted order.

Dictionary (``rbdict``)::

>>> import pyredblack
>>> d = pyredblack.rbdict(Germany = 'Berlin',
Hungary = 'Budapest',
Ireland = 'Dublin',
Portugal = 'Lisbon',
Cyprus = 'Nicosia',
Greenland = 'Nuuk',
Iceland = 'Reykjavik',
Macedonia = 'Skopje',
Bulgaria = 'Sofia',
Sweden = 'Stockholm')
>>> len(d)
>>> d['Ireland']
>>> d.keys()
['Bulgaria', 'Cyprus', 'Germany', 'Greenland', 'Hungary',
'Iceland', 'Ireland', 'Macedonia', 'Portugal', 'Sweden']
>>> d.values()
['Sofia', 'Nicosia', 'Berlin', 'Nuuk', 'Budapest',
'Reykjavik', 'Dublin', 'Skopje', 'Lisbon', 'Stockholm']
>>> d.popitem()
('Bulgaria', 'Sofia')
>>> d.popitem()
('Cyprus', 'Nicosia')
>>> d.popitem()
('Germany', 'Berlin')

Set (``rbset``)::

>>> fruit = pyredblack.rbset(['apple', 'orange', 'apple', 'pear',
'orange', 'banana'])
>>> 'orange' in fruit
>>> 'crabgrass' in fruit
>>> a = pyredblack.rbset('abracadabra')
>>> b = pyredblack.rbset('alacazam')
>>> list(a)
['a', 'b', 'c', 'd', 'r']
>>> list(a - b)
['b', 'd', 'r']
>>> list(a | b)
['a', 'b', 'c', 'd', 'l', 'm', 'r', 'z']
>>> list(a & b)
['a', 'c']
>>> list(a ^ b)
['b', 'd', 'l', 'm', 'r', 'z']
>>> a.pop()
>>> a.pop()
>>> a.pop()


- Python 2.7, Python 3.2+
- Cython (and a C++ compiler)


- implement slicing on dictionaries
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyredblack-0.1.0-cp27-none-macosx_10_7_x86_64.whl (169.6 kB) Copy SHA256 Checksum SHA256 cp27 Wheel Feb 26, 2015
pyredblack-0.1.0-cp34-cp34m-macosx_10_7_x86_64.whl (70.9 kB) Copy SHA256 Checksum SHA256 cp34 Wheel Feb 26, 2015
pyredblack-0.1.0.tar.gz (79.7 kB) Copy SHA256 Checksum SHA256 Source Feb 26, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting