lxml.html._setmixin module — lxml documentation

# lxml.html._setmixin module

class lxml.html._setmixin.SetMixin

  Bases: `MutableSet`

  Mix-in for sets. You must define __iter__, add, remove

  classmethod _from_iterable(it)

    Construct an instance of the class from any iterable input.

    Must override this method if the class constructor signature does not accept an iterable for an input.

  _hash()

    Compute the hash value of a set.

    Note that we don’t define __hash__: not all sets are hashable. But if you define a hashable set type, its __hash__ should call this function.

    This must be compatible __eq__.

    All sets ought to compare equal if they contain the same elements, regardless of how they are implemented, and regardless of the order of the elements; so there’s not much freedom for __eq__ or __hash__. We match the algorithm used by the built-in frozenset type.

  abstractmethod add(value)

    Add an element.

  clear()

    This is slow (creates N new iterators!) but effective.

  copy()
  difference(other)
  difference_update(other)
  discard(item)

    Remove an element. Do not raise an exception if absent.

  intersection(other)
  intersection_update(other)
  isdisjoint(other)

    Return True if two sets have a null intersection.

  issubset(other)

    Return self<=value.

  issuperset(other)

    Return self>=value.

  pop()

    Return the popped value. Raise KeyError if empty.

  remove(value)

    Remove an element. If not a member, raise a KeyError.

  symmetric_difference(other)
  symmetric_difference_update(other)
  union(other)

    Return self|value.

  update(other)
  _abc_impl = <_abc._abc_data object>