diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-03-11 07:30:21 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-03-11 07:30:21 (GMT) |
commit | af8838f4430cec7ba36caf3ce419a5205451c02a (patch) | |
tree | dca3f98c2011d5032c6d97effb9fa063e9ff4039 /Doc | |
parent | 42a541bd490fbf8eb9f4bf0399f3411b5f3e5d87 (diff) | |
download | cpython-af8838f4430cec7ba36caf3ce419a5205451c02a.zip cpython-af8838f4430cec7ba36caf3ce419a5205451c02a.tar.gz cpython-af8838f4430cec7ba36caf3ce419a5205451c02a.tar.bz2 |
#17351: remove "object" inheritance from docs. Patch by Phil Elson.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/howto/descriptor.rst | 6 | ||||
-rw-r--r-- | Doc/howto/logging-cookbook.rst | 6 | ||||
-rw-r--r-- | Doc/howto/sorting.rst | 2 | ||||
-rw-r--r-- | Doc/library/functions.rst | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst index 1616f67..f8763d8 100644 --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -224,17 +224,17 @@ here is a pure Python equivalent:: if obj is None: return self if self.fget is None: - raise AttributeError, "unreadable attribute" + raise AttributeError("unreadable attribute") return self.fget(obj) def __set__(self, obj, value): if self.fset is None: - raise AttributeError, "can't set attribute" + raise AttributeError("can't set attribute") self.fset(obj, value) def __delete__(self, obj): if self.fdel is None: - raise AttributeError, "can't delete attribute" + raise AttributeError("can't delete attribute") self.fdel(obj) The :func:`property` builtin helps whenever a user interface has granted diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst index 673b6b5..c361938 100644 --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1036,7 +1036,7 @@ arbitrary object as a message format string, and that the logging package will call ``str()`` on that object to get the actual format string. Consider the following two classes:: - class BraceMessage(object): + class BraceMessage: def __init__(self, fmt, *args, **kwargs): self.fmt = fmt self.args = args @@ -1045,7 +1045,7 @@ following two classes:: def __str__(self): return self.fmt.format(*self.args, **self.kwargs) - class DollarMessage(object): + class DollarMessage: def __init__(self, fmt, **kwargs): self.fmt = fmt self.kwargs = kwargs @@ -1345,7 +1345,7 @@ works:: import random import time - class MyHandler(object): + class MyHandler: """ A simple handler for logging events. It runs in the listener process and dispatches events to loggers based on the name in the received record, diff --git a/Doc/howto/sorting.rst b/Doc/howto/sorting.rst index 00bc6f7..f2e64ee 100644 --- a/Doc/howto/sorting.rst +++ b/Doc/howto/sorting.rst @@ -225,7 +225,7 @@ function. The following wrapper makes that easy to do:: def cmp_to_key(mycmp): 'Convert a cmp= function into a key= function' - class K(object): + class K: def __init__(self, obj, *args): self.obj = obj def __lt__(self, other): diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 0d8f61c..99f8335 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -317,7 +317,7 @@ are always available. They are listed here in alphabetical order. ['Struct', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_clearcache', 'calcsize', 'error', 'pack', 'pack_into', 'unpack', 'unpack_from'] - >>> class Shape(object): + >>> class Shape: def __dir__(self): return ['area', 'perimeter', 'location'] >>> s = Shape() |