simonpercivall / orderedset

Ordered Set implementation in Cython
Other
74 stars 14 forks source link

Slicing doesn't work on OrderedSet #1

Closed pjrobertson closed 10 years ago

pjrobertson commented 10 years ago

As expected, OrderedSet behaves much like a normal set (and a list as well)

>>> OrderedSet([1,4,2]) == [1,4,2]
True

however, it would be nice to be able to perform slices on them as well:

>>> [1,4,2][2:]
[2]
>>>
>>> OrderedSet([1,4,2])[2:]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_orderedset.pyx", line 343, in orderedset._orderedset._OrderedSet.__getitem__ (lib/orderedset/_orderedset.c:6276)
TypeError: an integer is required
simonpercivall commented 10 years ago

This is resolved in the 1.1 release.

pjrobertson commented 10 years ago

Nice. Quick work!