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 /Lib | |
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 'Lib')
-rw-r--r-- | Lib/sets.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/sets.py b/Lib/sets.py index 9604249..0824fb1 100644 --- a/Lib/sets.py +++ b/Lib/sets.py @@ -248,7 +248,7 @@ class BaseSet(object): try: return element in self._data except TypeError: - transform = getattr(element, "_as_temporarily_immutable", None) + transform = getattr(element, "__as_temporarily_immutable__", None) if transform is None: raise # re-raise the TypeError exception we caught return transform() in self._data @@ -325,7 +325,7 @@ class BaseSet(object): data[element] = value return except TypeError: - transform = getattr(element, "_as_immutable", None) + transform = getattr(element, "__as_immutable__", None) if transform is None: raise # re-raise the TypeError exception we caught data[transform()] = value @@ -335,7 +335,7 @@ class BaseSet(object): try: data[element] = value except TypeError: - transform = getattr(element, "_as_immutable", None) + transform = getattr(element, "__as_immutable__", None) if transform is None: raise # re-raise the TypeError exception we caught data[transform()] = value @@ -464,7 +464,7 @@ class Set(BaseSet): try: self._data[element] = True except TypeError: - transform = getattr(element, "_as_immutable", None) + transform = getattr(element, "__as_immutable__", None) if transform is None: raise # re-raise the TypeError exception we caught self._data[transform()] = True @@ -477,7 +477,7 @@ class Set(BaseSet): try: del self._data[element] except TypeError: - transform = getattr(element, "_as_temporarily_immutable", None) + transform = getattr(element, "__as_temporarily_immutable__", None) if transform is None: raise # re-raise the TypeError exception we caught del self._data[transform()] @@ -496,11 +496,11 @@ class Set(BaseSet): """Remove and return an arbitrary set element.""" return self._data.popitem()[0] - def _as_immutable(self): + def __as_immutable__(self): # Return a copy of self as an immutable set return ImmutableSet(self) - def _as_temporarily_immutable(self): + def __as_temporarily_immutable__(self): # Return self wrapped in a temporarily immutable set return _TemporarilyImmutableSet(self) |