mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
SF bug #1179957: Missing def'n of equality for set elements
This commit is contained in:
parent
95ed80b0e0
commit
e490502e04
2 changed files with 7 additions and 1 deletions
|
|
@ -1220,6 +1220,9 @@ Accordingly, sets do not implement the \method{__cmp__} method.
|
|||
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}.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue