Skip to content

Document `OrderedSet.remove` has linear complexity

Choose a tag to compare

@Techcable Techcable released this 22 Jun 01:48
· 1 commit to master since this release
f8071c3

Document that OrderedSet.remove method has linear complexity, unlike set.remove which takes O(1) time. This can potentially cause quadratic blow up if called inside a loop.

To work around this, use OrderedSet.__isub__ to remove items in bulk.

Full Changes

  • Document the fact OrderedSet.remove takes linear time
    • Add test to check for this behavior (currently failing, since it takes linear instead of constant time)
    • Explicitly implement in-place bulk methods __ior__, __iand__ to avoid quadratic blow up
  • Explicitly implement OrderedSet.remove (previously implemented by superclass)
  • Switch build from setuptools to hatchling