Commit af8838f4 authored by Ezio Melotti's avatar Ezio Melotti

#17351: remove "object" inheritance from docs. Patch by Phil Elson.

parent 42a541bd
...@@ -224,17 +224,17 @@ here is a pure Python equivalent:: ...@@ -224,17 +224,17 @@ here is a pure Python equivalent::
if obj is None: if obj is None:
return self return self
if self.fget is None: if self.fget is None:
raise AttributeError, "unreadable attribute" raise AttributeError("unreadable attribute")
return self.fget(obj) return self.fget(obj)
def __set__(self, obj, value): def __set__(self, obj, value):
if self.fset is None: if self.fset is None:
raise AttributeError, "can't set attribute" raise AttributeError("can't set attribute")
self.fset(obj, value) self.fset(obj, value)
def __delete__(self, obj): def __delete__(self, obj):
if self.fdel is None: if self.fdel is None:
raise AttributeError, "can't delete attribute" raise AttributeError("can't delete attribute")
self.fdel(obj) self.fdel(obj)
The :func:`property` builtin helps whenever a user interface has granted The :func:`property` builtin helps whenever a user interface has granted
......
...@@ -1036,7 +1036,7 @@ arbitrary object as a message format string, and that the logging package will ...@@ -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 call ``str()`` on that object to get the actual format string. Consider the
following two classes:: following two classes::
class BraceMessage(object): class BraceMessage:
def __init__(self, fmt, *args, **kwargs): def __init__(self, fmt, *args, **kwargs):
self.fmt = fmt self.fmt = fmt
self.args = args self.args = args
...@@ -1045,7 +1045,7 @@ following two classes:: ...@@ -1045,7 +1045,7 @@ following two classes::
def __str__(self): def __str__(self):
return self.fmt.format(*self.args, **self.kwargs) return self.fmt.format(*self.args, **self.kwargs)
class DollarMessage(object): class DollarMessage:
def __init__(self, fmt, **kwargs): def __init__(self, fmt, **kwargs):
self.fmt = fmt self.fmt = fmt
self.kwargs = kwargs self.kwargs = kwargs
...@@ -1345,7 +1345,7 @@ works:: ...@@ -1345,7 +1345,7 @@ works::
import random import random
import time import time
class MyHandler(object): class MyHandler:
""" """
A simple handler for logging events. It runs in the listener process and 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, dispatches events to loggers based on the name in the received record,
......
...@@ -225,7 +225,7 @@ function. The following wrapper makes that easy to do:: ...@@ -225,7 +225,7 @@ function. The following wrapper makes that easy to do::
def cmp_to_key(mycmp): def cmp_to_key(mycmp):
'Convert a cmp= function into a key= function' 'Convert a cmp= function into a key= function'
class K(object): class K:
def __init__(self, obj, *args): def __init__(self, obj, *args):
self.obj = obj self.obj = obj
def __lt__(self, other): def __lt__(self, other):
......
...@@ -317,7 +317,7 @@ are always available. They are listed here in alphabetical order. ...@@ -317,7 +317,7 @@ are always available. They are listed here in alphabetical order.
['Struct', '__builtins__', '__doc__', '__file__', '__name__', ['Struct', '__builtins__', '__doc__', '__file__', '__name__',
'__package__', '_clearcache', 'calcsize', 'error', 'pack', 'pack_into', '__package__', '_clearcache', 'calcsize', 'error', 'pack', 'pack_into',
'unpack', 'unpack_from'] 'unpack', 'unpack_from']
>>> class Shape(object): >>> class Shape:
def __dir__(self): def __dir__(self):
return ['area', 'perimeter', 'location'] return ['area', 'perimeter', 'location']
>>> s = Shape() >>> s = Shape()
......
...@@ -303,6 +303,7 @@ Eric Eisner ...@@ -303,6 +303,7 @@ Eric Eisner
Andrew Eland Andrew Eland
Julien Élie Julien Élie
Lance Ellinghaus Lance Ellinghaus
Phil Elson
David Ely David Ely
Jeff Epler Jeff Epler
Tom Epperly Tom Epperly
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment