diff options
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r-- | Doc/library/functions.rst | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 764fd8f..af005b3 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -256,7 +256,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 Foo(object): + >>> class Foo: ... def __dir__(self): ... return ["kan", "ga", "roo"] ... @@ -864,7 +864,7 @@ are always available. They are listed here in alphabetical order. function for setting, and *fdel* a function for del'ing, an attribute. Typical use is to define a managed attribute ``x``:: - class C(object): + class C: def __init__(self): self._x = None @@ -883,7 +883,7 @@ are always available. They are listed here in alphabetical order. property will copy *fget*'s docstring (if it exists). This makes it possible to create read-only properties easily using :func:`property` as a :term:`decorator`:: - class Parrot(object): + class Parrot: def __init__(self): self._voltage = 100000 @@ -900,7 +900,7 @@ are always available. They are listed here in alphabetical order. corresponding accessor function set to the decorated function. This is best explained with an example:: - class C(object): + class C: def __init__(self): self._x = None @@ -1200,7 +1200,7 @@ are always available. They are listed here in alphabetical order. attribute. For example, the following two statements create identical :class:`type` objects: - >>> class X(object): + >>> class X: ... a = 1 ... >>> X = type('X', (object,), dict(a=1)) |