Author: raymond.hettinger Date: Sat Feb 9 04:48:16 2008 New Revision: 60685
Modified: python/branches/py3k/Doc/library/collections.rst Log: Add another usage note for collections.Set Modified: python/branches/py3k/Doc/library/collections.rst ============================================================================== --- python/branches/py3k/Doc/library/collections.rst (original) +++ python/branches/py3k/Doc/library/collections.rst Sat Feb 9 04:48:16 2008 @@ -58,7 +58,7 @@ ``insert``, ``remove``, and ``__iadd__`` and ``__len__`` -:class:`Set` \(1) \(2) :class:`Sized`, ``__len__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, +:class:`Set` :class:`Sized`, ``__len__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, :class:`Iterable`, ``__iter__``, and ``__gt__``, ``__ge__``, ``__and__``, ``__or__`` :class:`Container` ``__contains__`` ``__sub__``, ``__xor__``, and ``isdisjoint`` @@ -118,6 +118,13 @@ semantics are fixed), redefine :meth:`__le__` and then the other operations will automatically follow suit. +(3) + The :class:`Set` mixin provides a :meth:`_hash` method to compute a hash value + for the set; however, :meth:`__hash__` is not defined because not all sets + are hashable or immutable. To add set hashabilty using mixins, + inherit from both :meth:`Set` and :meth:`Hashable`, then define + ``__hash__ = Set._hash``. + (For more about ABCs, see the :mod:`abc` module and :pep:`3119`.) _______________________________________________ Python-3000-checkins mailing list Python-3000-checkins@python.org http://mail.python.org/mailman/listinfo/python-3000-checkins