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

safesort does what it says on the box: guarantees safe sorting of arbitrary heterogeneous lists across Python 2 and Python 3:

>>> list(sorted(["a", 1, None]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: int() < str()
>>> list(safesort(["a", 1, None))
[None, 1, 'a']

Three ordering keys are attempted for each comparison:

  1. Object: objA > objB
  2. Type-and-object: (type(objA).__mro__, objA) > (type(objB).__mro__, objB)
  3. Type-and-identity: (type(objA).__mro__, id(objA)) > (type(objB).__mro__, id(objB))

This guarantees a total ordering which is:

  1. As consistent as possible
  2. Broadly sensible: objects with similar types will be grouped together

For example:

>>> from safesort import safesort
>>> input = ['a', set([]), [], {}, 1, None]
>>> list(safesort(input))
[None, 1, {}, [], set([]), 'a']


safesort can be installed with Python 2 or Python 3 using pip or easy_install:

$ pip install safesort
- OR -
$ easy_install safesort
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
safesort-0.2.0-py2.py3-none-any.whl (4.1 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Jun 19, 2015
safesort-0.2.0.tar.gz (2.5 kB) Copy SHA256 Checksum SHA256 Source Jun 19, 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