Skip to content

FVolral/orderedset

 
 

Repository files navigation

Ordered Set

image

image

image

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.

About

Ordered Set implementation in Cython

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.7%
  • Makefile 3.3%