Skip to content

Commit ae2ee1d

Browse files
committed
Fix indentation v2
1 parent ca5eb25 commit ae2ee1d

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

Doc/faq/programming.rst

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,18 +1912,20 @@ correctly using identity tests:
19121912
2) Detecting optional arguments can be tricky when ``None`` is a valid input
19131913
value. In those situations, you can create a singleton sentinel object
19141914
guaranteed to be distinct from other objects. For example, here is how
1915-
to implement a method that behaves like :meth:`dict.pop`::
1916-
1917-
_sentinel = object()
1918-
1919-
def pop(self, key, default=_sentinel):
1920-
if key in self:
1921-
value = self[key]
1922-
del self[key]
1923-
return value
1924-
if default is _sentinel:
1925-
raise KeyError(key)
1926-
return default
1915+
to implement a method that behaves like :meth:`dict.pop`:
1916+
1917+
.. code-block:: python
1918+
1919+
_sentinel = object()
1920+
1921+
def pop(self, key, default=_sentinel):
1922+
if key in self:
1923+
value = self[key]
1924+
del self[key]
1925+
return value
1926+
if default is _sentinel:
1927+
raise KeyError(key)
1928+
return default
19271929
19281930
3) Container implementations sometimes need to augment equality tests with
19291931
identity tests. This prevents the code from being confused by objects

0 commit comments

Comments
 (0)