Skip to main content

An Ordered Set implementation in Cython.

Project description

https://badge.fury.io/py/orderedset.png https://travis-ci.org/simonpercivall/orderedset.png?branch=master https://pypip.in/d/orderedset/badge.png

An Ordered Set implementation in Cython. Based on Raymond Hettinger’s OrderedSet recipe.

Example:

>>> from orderedset import OrderedSet
>>> oset = OrderedSet([1, 2, 3])
>>> oset
OrderedSet([1, 2, 3])
>>> oset | [5, 4, 3, 2, 1]
OrderedSet([1, 2, 3, 5, 4])

Features

  • Works like a regular set, but remembers insertion order;

  • Is approximately 5 times faster than the pure Python implementation overall (and 5 times slower than set);

  • Compatible with Python 2.6 through 3.6.;

  • Supports the full set interface;

  • Supports some list methods, like index and __getitem__.

  • Supports set methods against iterables.

Changelog

2.0.2 - 2020-02-25

  • bugfix: Fix deprecation warning for collections.abc in Python 3.8+

2.0.1 - 2018-03-20

  • bugfix: Fix isdisjoint to return True when the sets are disjoint

  • build: Include 3.6 when testing

  • dist: Include test files in sdist

  • docs: Make the Readme a bit prettier

2.0 - 2016-02-02

  • breaking change: All comparisons, other than eq, against other ordered sets are now performed unordered; i.e., they are treated as regular sets.

  • isorderedsubset and isorderedsuperset have been added to perform ordered comparisons against other sequences. Using these methods with unordered collections wield yield arbitrary (and depending on Python implementation, unstable) results.

1.2 - 2015-09-29

  • bugfix: Set operations only worked with iterables if the OrderedSet was on the left-hand side. They now work both ways.

  • bugfix: The order of an intersection was the right-hand side’s order. It is now fixed to be the left-hand side’s order.

1.1.2 - 2014-10-02

  • Make comparisons work with sets and lists, and not crash when compared with None.

1.1.1 - 2014-08-24

  • Add pickle/copy support to OrderedSet

1.1 - 2014-06-04

  • Make OrderedSets handle slicing in __getitem__().

1.0.2 - 2014-05-14

  • Add proper attribution and licenses.

1.0.1 - 2014-05-13

  • Don’t require Cython to build an sdist.

1.0 - 2014-05-11

  • First implementation.

Project details


Download files

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

Source Distribution

orderedset-2.0.2.tar.gz (79.5 kB view details)

Uploaded Source

File details

Details for the file orderedset-2.0.2.tar.gz.

File metadata

  • Download URL: orderedset-2.0.2.tar.gz
  • Upload date:
  • Size: 79.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.6

File hashes

Hashes for orderedset-2.0.2.tar.gz
Algorithm Hash digest
SHA256 285ca273c7cdd545358b6e643160bd110117a221af7319740526b66ac1cb4bec
MD5 e51a7460f3164b7bc52dfc5c000e9081
BLAKE2b-256 d60404150a0fd248844e7265f14789f3b36493f8235a27de103d0f0f19a12f61

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page