Mercurial > cpython-lru_cache-weakref
diff Doc/lib/libstdtypes.tex @ 34898:fbcb1da480dd 2.4
SF bug #1179957: Missing def'n of equality for set element
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Sun, 10 Apr 2005 17:36:26 +0000 |
| parents | 19327db75d1c |
| children | 6bdc3426d411 |
line wrap: on
line diff
--- a/Doc/lib/libstdtypes.tex Sun Apr 10 16:23:49 2005 +0000 +++ b/Doc/lib/libstdtypes.tex Sun Apr 10 17:36:26 2005 +0000 @@ -1220,6 +1220,9 @@ Since sets only define partial ordering (subset relationships), the output of the \method{list.sort()} method is undefined for lists of sets. +Set elements are like dictionary keys; they need to define both +\method{__hash__} and \method{__eq__} methods. + Binary operations that mix \class{set} instances with \class{frozenset} return the type of the first operand. For example: \samp{frozenset('ab') | set('bc')} returns an instance of \class{frozenset}.
