diff options
author | Raymond Hettinger <python@rcn.com> | 2003-02-14 03:42:11 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-02-14 03:42:11 (GMT) |
commit | 2835e37be55ce054b6a80f1c7b99de65717f2a12 (patch) | |
tree | 3e1425b9e5e2cdda4dff2605a0d50e78e8756103 /Doc/lib/libsets.tex | |
parent | e544f6f682f46fe8c1a170470831ce67136354a5 (diff) | |
download | cpython-2835e37be55ce054b6a80f1c7b99de65717f2a12.zip cpython-2835e37be55ce054b6a80f1c7b99de65717f2a12.tar.gz cpython-2835e37be55ce054b6a80f1c7b99de65717f2a12.tar.bz2 |
SF bug #663701: sets module review
Renamed hook methods to use the double underscore convention.
Diffstat (limited to 'Doc/lib/libsets.tex')
-rw-r--r-- | Doc/lib/libsets.tex | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/lib/libsets.tex b/Doc/lib/libsets.tex index 9c5998a..4d87a4f 100644 --- a/Doc/lib/libsets.tex +++ b/Doc/lib/libsets.tex @@ -203,23 +203,23 @@ before being added as a set element. The mechanism is to always add a hashable element, or if it is not hashable, the element is checked to see if it has an -\method{_as_immutable()} method which returns an immutable equivalent. +\method{__as_immutable__()} method which returns an immutable equivalent. -Since \class{Set} objects have a \method{_as_immutable()} method +Since \class{Set} objects have a \method{__as_immutable__()} method returning an instance of \class{ImmutableSet}, it is possible to construct sets of sets. A similar mechanism is needed by the \method{__contains__()} and \method{remove()} methods which need to hash an element to check for membership in a set. Those methods check an element for hashability -and, if not, check for a \method{_as_temporarily_immutable()} method +and, if not, check for a \method{__as_temporarily_immutable__()} method which returns the element wrapped by a class that provides temporary methods for \method{__hash__()}, \method{__eq__()}, and \method{__ne__()}. The alternate mechanism spares the need to build a separate copy of the original mutable object. -\class{Set} objects implement the \method{_as_temporarily_immutable()} +\class{Set} objects implement the \method{__as_temporarily_immutable__()} method which returns the \class{Set} object wrapped by a new class \class{_TemporarilyImmutableSet}. |